juniorWebSockets
What is the WebSocket handshake process?
Updated May 6, 2026
Short answer
The WebSocket handshake upgrades an HTTP connection to a persistent WebSocket connection.
Deep explanation
The client sends an HTTP request with an Upgrade header. The server responds with a 101 Switching Protocols status, confirming the upgrade. After this, the connection switches from HTTP to WebSocket protocol.
Real-world example
Browser connecting to a live chat server.
Common mistakes
- Assuming WebSocket starts without HTTP handshake.
Follow-up questions
- What does HTTP 101 mean?