uWebSockets.js
uWebSockets.js copied to clipboard
Is it possible to pass a socket handle directly to uWS?
eg, something equivalent to handleUpgrade.
The reason this is useful is that, combined with passing socket handles across processes, you can route all sockets based on the same topic to the same process in a node cluster:
- https://nodejs.org/api/child_process.html#example-sending-a-socket-object
This was asked before here: https://github.com/uNetworking/uWebSockets.js/issues/649
That guy was trying to do 1 socket per process which was a bad idea, your use case makes more sense but is not possible with uWS.js from what I understand, that is a Node socket feature
That's what it looked like to me too, just wanted to check. Thanks for the quick reply @e3dio!
It's still a good feature request
I'm closing this, it's not a bad idea but it is a too complex idea for the gain - just let sockets fall wherever they fall and use the pub/sub or direct connections based on some URL query value or something like that. Point is - you can achieve pretty good results without this kind of low level hackery. But yes it is a good idea. But no, I have no time to implement and maintain this edge case (and it kind of goes against the simple nature of uWS)