AES Encryption Explained: How It Works and Why It Matters
Jun 23, 2026
1xx Informational
The 101 (Switching Protocols) status code indicates the server understands and is willing to comply with the client's request to switch protocols. The server will include an Upgrade header to indicate which protocol it is switching to. This is the cornerstone of WebSocket connections — when a client sends an Upgrade: websocket header, the server responds with 101 to confirm the protocol switch from HTTP to WebSocket, enabling real-time bidirectional communication.
When building a real-time chat application, your JavaScript client uses the WebSocket API to initiate a connection. The browser sends an HTTP Upgrade request, and if the server supports WebSockets, it responds with 101 Switching Protocols. From that point forward, the connection operates as a WebSocket rather than HTTP.
// JavaScript - Client-side WebSocket handshake
const ws = new WebSocket('wss://api.example.com/chat');
ws.onopen = () => console.log('Connected (101 Switching Protocols)');
ws.onmessage = (e) => console.log('Received:', e.data);
Mistake: Trying to send HTTP requests after a 101 protocol switch
Fix: Once the protocol switches (e.g., to WebSocket), the connection no longer speaks HTTP. Use the upgraded protocol's framing for all subsequent communication.
Mistake: Forgetting to validate the Upgrade header on the server side
Fix: Always verify that the Upgrade header contains a protocol your server supports (e.g., "websocket"). Respond with 426 Upgrade Required if the requested protocol is not supported.
Blog
Jun 23, 2026
Jun 23, 2026
Jun 23, 2026
Jun 23, 2026
Jun 23, 2026
Jun 23, 2026