Production Concerns
Backpressure and flow control, error handling, liveness and heartbeats, stateless and Kafka-backed reconnect, security, and fan-out at scale: the concerns that show up once a socket is live.
Backpressure and Flow Control
A bounded outbound path per connection, two signals that trip it, and a CLOSE or DROP policy for a server pushing to slow clients.
Error Handling
Close codes, an in-band error envelope, and per-code retry rules for a connection that has no status line.
Liveness and Heartbeats
Detecting a dead connection before the application does, with ping/pong and a pong-tracked liveness sweep.
Reconnect: Stateless
What a client loses when it reconnects to a server that keeps no event history, and when that loss is acceptable.
Reconnect: Kafka-Backed
Resuming a reconnecting client from a durable Kafka topic, and absorbing the duplicate delivery that replay can cause.
Security
Authenticating a long-lived connection at the upgrade with a bearer JWT, and the attack surface specific to WebSockets.
Scale-Out and Fan-Out
Fanning one event out to every connected client across several server instances, with a Kafka or a Redis backplane.