joyent/node — Issue #2323: Allow sharing sockets between processes
Author: VanCoding
Created: 2011-12-13 16:11:13+00:00
State: open

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:
1) A login server accepts a the connections & the client logs in over it
2) After the login, the server passes the socket for example to one of the "game-lobby" processes
3) The user joins a game. When the game starts, the lobby server passes the connection to a game process, which runs only for this game.
4) After the game ends, the game process passes the socket back to the lobby process, which updates his statistics.

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 :)