Create server follow another http or https server #15
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
RT, like https://www.npmjs.com/package/ws support new WebSocketServer({server: httpServer});
I'm working on a project that is using nodejs-websocket
I'm about to need to add a Web Socket API on the same server / port than an existing REST-like HTTP API
This ticket has been closed without comment
Does it means:
Maybe there is another approach available, like:
Thanks,
Regards
Looks like similar requirement was raised in #3
From the answer on that ticket, one of the limitation would be that this module is directly bound to the tls.Server or net.Server socket level without the http layer
So...
I looked a bit...
Which means that when the
nodejs-websocketserver is created via createServer() it could accept an already existing http or https server socket, instead of creating a new one, if one if provided as option. Callinginstanceoftls.TLSSocket/net.Socketcould even work for a more generic usage.It may worth a try
Didn't tested but the implementation could look like
Plus some code to handle the upgrade handshake
I tried to implement it

I'm almost there
Still an initial message to catch
looks good.
I've implemented in #66, you can try to use it and check if everything works well