WebSocket protocol — full-duplex bidirectional communication. Upgrade from HTTP/1.1 to WS frames. Use cases: chat, real-time dashboards, collaborative editors, live trading. Heartbeats, reconnection, scaling via sticky sessions and Redis pub/sub backplane. Includes 4 scenarios: handshake (HTTP Upgrade -> 101 Switching Protocols), bidirectional message flow (typing/presence/text/binary frames), broadcast via Redis pub/sub fan-out across gateway nodes, and connection drop on mobile with reconnect+resync via last_seq. ADRs cover WebSocket vs SSE vs long-poll vs WebRTC, plus heartbeat/reconnect/backpressure discipline.
WebSocket is a framed, full-duplex protocol that begins with an opening handshake. In the common HTTP/1.1 mapping, the server returns 101 and the same underlying connection carries frames. TLS secures wss, while frame masking, authorization, liveness, replay, and reconnect remain separate concerns.
HTTP opening handshake through a proxy. The client establishes TLS for wss and negotiates WebSocket; a reverse proxy creates a separate upstream connection.
Full-duplex messages, ping, and close. Either endpoint can send after opening, but control-frame and close-handshake rules still apply.
Cross-gateway fan-out. Every gateway dials the broker; broker-to-gateway animations therefore traverse those dependencies in reverse.
Reconnect with bounded resynchronization. A dropped TCP connection loses in-flight state; reconnect is a new handshake and replay is an application protocol.
Введите числа или выберите пресет