Sticky Sessions and WebSocket Routing
Configure load balancers to route stateful WebSocket connections correctly using sticky sessions, and learn when a shared broker removes that need.
WebSockets Are Long-Lived
Unlike a stateless HTTP request, a WebSocket is a persistent connection pinned to one server instance for its entire life. This breaks the assumption load balancers make about HTTP.
The Routing Problem
If the in-memory simple broker holds a user's subscriptions on instance A, a message that lands on instance B has nowhere to deliver. The connection state lives only where the socket terminated.
All lessons in this course
- WebSockets in Microservice Architectures
- Cloud Deployment Strategies (AWS/GCP)
- Load Balancing and High Availability
- Sticky Sessions and WebSocket Routing