Socket.io in nodejs cluster
Running nodejs in cluster is a bit tricky. We need to make sure the same worker handle the same connection from the same client.
To make life a little bit easier, we can use Sticky Session
$npm install sticky-session
And we need to use socket.io-redis to make sure we can send message to socket handle by different workers.
$npm install socket.io-redis
Related
Sticky Session
Using multiple nodes
Node cluster socket.io