Software Design

WebSocket Handshake and Keep-Alive Lifecycle

UML Sequence Diagrams · made in Skemio

Sequence diagram illustrating a client upgrading an HTTP request to a WebSocket connection via a proxy and server, followed by bidirectional frames and ping-pong keep-alive.
Sequence diagram illustrating a client upgrading an HTTP request to a WebSocket connection via a proxy and server, followed by bidirectional frames and ping-pong keep-alive.

What it shows

  • Client sends HTTP GET with Upgrade: websocket and Connection headers
  • Server replies with HTTP 101 Switching Protocols to establish socket
  • Lightweight ping/pong heartbeat frames detect broken TCP connections

The takeaway

WebSockets bootstrap over standard HTTP ports, then transition to raw TCP framing.

More uml sequence diagrams