-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Allow sharing sockets between processes #2323
Comments
No comments on this feature request? http://tangentsoft.net/wskfaq/articles/passing-sockets.html we would just need 2 functions in the net module: This would be an absolute killer feature! |
This is now supported by `child_process.fork().send(message, handle); So please close. |
Where can I read about how it works? Is this feature documented anywhere? Which version do I have to use? |
Oh, I might have missread. The API is documented here: http://nodejs.org/docs/latest/api/child_processes.html#child_process.fork |
Yes, I think so. |
I´ve an idea how an implementation into the current cluster logic could look like:
|
We're not going to do this at this time. This is a cute API, and surely handy, but doing it this way would require massive change to how it works, and could probably never be as performant as what we've got now. |
@VanCoding I have made a pull request about this, but there is still issues there need to be solved. |
omg it's so great so see someone has implemented such a feature. This definately must be pulled! |
I've created a module for this now. It doesn't work on windows tough. https://github.com/VanCoding/node-ancillary |
Did this functionality ever make it into mainline? |
Yes, sockets and servers can be sent between processes. See https://nodejs.org/api/child_process.html#child_process_child_send_message_sendhandle_options_callback. |
The documentation says that its only possible between 2 nodejs processes having parent-child relationship Thank you! |
Hi guys!
It would be GREAT to be able to share sockets between node.js processes. So, a server node could accept incoming connections and pass them to other nodes, which are then absolutely independent of the server node. They are not forks or childprocesses, like with the "cluster" solution.
The process that gets the socket could now directly write & read to the socket. No piping would be needed.
A socket could be passed between processes as many times as needed.
Example for a game server concept:
Using piping, this would be impossible, since it would be to slow. Being able to read/write to the socket DIRECTLY, heavily decreases the latency compared to classic piping.
Not only for this game server concept, this would be SO USEFUL to all sorts of applications. I bet that programmers would love it.
Hope you implement it :)
The text was updated successfully, but these errors were encountered: