How to create a websocket server plugin and run Photoshop API through client

I need to know how to create a websocket server as UXP plugin being launched by photoshop. Therefore, I could use client to send message to server for executing the Photoshop API!!

UXP can’t do WS server. It can do only client.

Thanks for your replying.
So I guess I need to find another way to do this.

I try to use to create a socket port while loading my plugin.

First question about “How to correct import or require module”:
When I tried this :
const { Server } = require(“”); -->>>Error: Module not found: “”. Parent module folder was: “./”
When I tried this :
import “ -->>>Cannot use import statement outside a module

Second question:
What if and websocket are not current support in UXP, how to open a port to do the way like my CEP extension?