WebSocket Handshake

noun

say it: “WEB-sah-kit HAND-shayk” /ˈwɛbˌsɑkɪt ˈhændˌʃeɪk/

The opening exchange in which a browser asks a server over HTTP to switch to a WebSocket and the server agrees.

What is the WebSocket handshake?

The WebSocket handshake is how a WebSocket starts: an ordinary HTTP request with an Upgrade: websocket header asks to switch, and the server's 101 Switching Protocols answer turns that connection into a WebSocket.

GET /scores HTTP/1.1
Host: localhost:8080
Upgrade: websocket
Connection: Upgrade

HTTP/1.1 101 Switching Protocols

In a sentence

  • “A proxy that drops the Upgrade header breaks the WebSocket handshake.”
  • “In the Network tab, the WebSocket handshake shows as one request answered with 101.”

Level: Freelancer · More Web Development terms at this level

Updated