WebSocket gateway tier
Your task
Design the WebSocket gateway tier for a platform with 10M concurrent persistent connections. Requirements: route a message destined for user U to whichever gateway node holds U's socket; survive node restarts/deploys without dropping all connections at once; handle reconnect storms (a deploy or network blip reconnects millions at once); and keep per-connection memory low. Messages must not be lost across a brief reconnect.
It covers
- Connection management
- Reconnection
- Horizontal scaling