Transferring websockets to child processes #626
Unanswered
andrewprivate
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Using process.send it is possible to pass a TCP socket object to a child process. By extension, it is possible to send some websocket connections across processes as well.
Currently, I am making use of this feature for better load-balancing in my small web game. While the server has multiple CPU cores, the game's world is single-threaded as a result of deterministic requirements. Moreover, for reasons dictated by external limitations, I can only use one port and it is not hosted on a linux server.
As of right now, I am using websockets/ws with
{ "noServer": true }
and node's http to transfer sockets to the appropriate processes as they are being upgraded. While I would rather use uWebSockets.js instead of ws, after looking at the uWebsockets.js documentation, I don't think it is currently possible for me to implement my one-port-multiple-process paradigm with uWebSockets.js. Still, I am not 100% sure if thats the case, please correct me if I am wrong.Other Resources:
ws: Passing a live socket to a child process
Beta Was this translation helpful? Give feedback.
All reactions