Switching Protocols — the server is switching to the protocol requested by the client
What 101 Means
The 101 error on the HTTP Status-Codes indicates switching protocols — the server is switching to the protocol requested by the client. This typically occurs due to upgrading an http connection to websockets.
A 101 Switching Protocols response is sent in reply to an Upgrade request header from the client. The server indicates which protocol it is switching to, allowing for real-time, bidirectional communication.
Technical Background
The 101 status is sent in response to an 'Upgrade' request header from the client. It signifies that the server agrees to switch the connection to a different protocol, such as moving from HTTP/1.1 to WebSockets.
This transition allows for full-duplex communication over a single TCP connection, which is essential for real-time applications like chat systems or live data feeds.
Common Causes
- Upgrading an HTTP connection to WebSockets
- Switching from HTTP/1.1 to HTTP/2
- Negotiating a different application-layer protocol via the Upgrade header
Typical Scenarios
- A web chat application upgrades its connection to WebSockets for real-time messaging
- A browser negotiates a protocol upgrade to a more efficient transport layer
What to Know
Reception of a 101 status confirms the successful upgrade of the communication channel. The connection state thereafter follows the rules of the newly negotiated protocol.
Frequently Asked Questions
Common questions about HTTP 101 error
Yes, it means the server agreed to the protocol upgrade requested by the client and the connection is transitioning.