How to start any server of weboscket or in electron?

The test code can be found here:

I need to use the websocket server in electron. During the process of trying, I found that the ws (npm package) used does not seem to be packaged, and ws cannot be found during startup.

Has anyone successfully used or websocket server in Electron?

FWIW, I’m using the dgram package and it gets the job done for me.