Node.js · Middle · Question 70 of 75
What is a challenge of WebSockets with several server instances?
- 1Each instance needs its own domain
- ✓Correct answer: Each connection lives on one instance, so broadcasting to all users needs a shared channel like Redis pub/sub
- 3WebSockets can't work behind a load balancer at all
Explanation
Libraries like Socket.IO provide adapters (Redis and others) for broadcasting across instances. Load balancers may also need sticky sessions for some transports.