If only WebSocket transport is used in server in multi-mode, do I need to enable both sticky sessions & use an adapter? #4687
-
I am planning to use socket.io for a chat application in a Docker Swarm cluster. The routing is done by Traefik router and the socket.io server will have a few replicas in the swarm network. According to the documentation, if I used only the WebSocket transport, I do not need to enable sticky sessions. So am I right to conclude that since my socket.io setup will be run in multiple containers, I need to use an adapter like the Redis adapter? Or do I also need to turn on sticky sessions? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Yep that's right 👍 |
Beta Was this translation helpful? Give feedback.
-
I would like to add that the same goes to Pm2 cluster, ie 1. using websocket and don't enable sticky session or 2. using @socket.io/pm2 @darrachequesne I know you have https://socket.io/docs/v4/pm2/ but maybe you can add some information about pm2 in https://socket.io/docs/v4/using-multiple-nodes/ after all pm2 cluster is also a kind of multiple-nodes. |
Beta Was this translation helpful? Give feedback.
Yep that's right 👍
Reference: https://socket.io/docs/v4/using-multiple-nodes/