6

Although the socket.io document said 'sticky session' can make socket.io work with node cluster. I just can't make it work.

I find pm2 had several issues opened against it, the closest solution I can find is this, "force to use websock option only", don't use sticky session at all.

Has anyone had any experience that makes node cluster work with socket.io?

------- update --------

I checked the other two sticky session implementations mentioned here, sticky-session vs socket.io-sticky-session node js library ! Which is better? , find 'sticky-cluster' can do the job.

Another lesson I learned is that sticky-session doesn't work well with pm2 cluster, e.g. confirm from https://github.com/uqee/sticky-cluster/issues/26. So don't use pm2 cluster mode when using socket.io(or use 'websocket' transport only).

The 'sticky-session' implementation mentioned in socket.io document actually works too. If anyone needs more explanation with code sample, please check here https://github.com/elad/node-cluster-socket.io !

I leave my question open because I still like to see if there are other inputs.

Qiulang
  • 7,465
  • 7
  • 63
  • 94

0 Answers0