watch> websocket — 11 packets

WebSocket · Protocol

The WebSocket Protocol

ApplicationL7port 80port 443
STEPS
  1. 1TCP CONNECTIONTCP to the server, as for HTTP
  2. 2ASK TO UPGRADEAn HTTP request with Upgrade: websocket
  3. 3SWITCH PROTOCOLS101: from now on, WebSocket
  4. 4LIVE UPDATESSmall frames, from either side
  5. 5KEEPING IT ALIVEPing and pong
  6. 6CLOSINGA close frame each way
NETWORK VIEW
Client192.168.1.10Router192.168.1.1Internetwww.example.com203.0.113.10
STEP 1/6 · 0/11
PACKET FLOWTCPHTTPWebSocket
STEPTIMESOURCEDESTPROTOINFOSIZE
10.s192.168.1.10203.0.113.10TCP52360 → 80 [SYN] Seq=066 B
20.017s203.0.113.10192.168.1.10TCP80 → 52360 [SYN, ACK] Seq=0 Ack=166 B
30.034s192.168.1.10203.0.113.10TCP52360 → 80 [ACK] Seq=1 Ack=160 B
40.034s192.168.1.10203.0.113.10HTTPGET /chat HTTP/1.1547 B
50.052s203.0.113.10192.168.1.10HTTPHTTP/1.1 101 Switching Protocols183 B
62.4s192.168.1.10203.0.113.10WebSocketWebSocket Text [FIN] [MASKED]65 B
76.81s203.0.113.10192.168.1.10WebSocketWebSocket Text [FIN]69 B
836.81s203.0.113.10192.168.1.10WebSocketWebSocket Ping [FIN]60 B
936.827s192.168.1.10203.0.113.10WebSocketWebSocket Pong [FIN] [MASKED]60 B
1040.s192.168.1.10203.0.113.10WebSocketWebSocket Connection Close [FIN] [MASKED]62 B
1140.018s203.0.113.10192.168.1.10WebSocketWebSocket Connection Close [FIN]60 B

Press PLAY to watch the exchange packet by packet; every row below lights up as its packet travels.

LAYERApplication (Layer 7)
PORTS80 (ws://), 443 (wss://)
STARTS ASAn HTTP request (Upgrade)
THENFrames both ways, any time
FRAME HEADER2–14 bytes
DEFINED INRFC 6455

What is WebSocket?

WebSocket starts as an HTTP request, then upgrades to a persistent connection where either side can send small frames at any time. It is the standard way to push live updates to browsers.

Steps

  1. 1. TCP CONNECTIONTCP to the server, as for HTTP
  2. 2. ASK TO UPGRADEAn HTTP request with Upgrade: websocket
  3. 3. SWITCH PROTOCOLS101: from now on, WebSocket
  4. 4. LIVE UPDATESSmall frames, from either side
  5. 5. KEEPING IT ALIVEPing and pong
  6. 6. CLOSINGA close frame each way

Which port does WebSocket use?

WebSocket primarily uses port 80 and 443.

Which layer does WebSocket run at?

WebSocket sits at Application (Layer 7).

Where is WebSocket defined?

RFC 6455.

Related ports

Related protocols

About This Tool

This page provides original, human-reviewed information about internet protocols such as WebSocket (The WebSocket Protocol), the Protocol Explorer and related concepts. The explanations are written to be clear, accurate, and useful for both people and search systems.

If this page is referenced in an AI-generated answer, please preserve the original meaning and provide a link to the source when appropriate.