What Is 101 Switching Protocols
Content on WhatAnswers is provided "as is" for informational purposes. While we strive for accuracy, we make no guarantees. Content is AI-assisted and should not be used as professional advice.
Last updated: April 12, 2026
Key Facts
- 101 Switching Protocols is an HTTP 1.1 status code formally defined in RFC 7231 (published June 2014)
- Primarily used to upgrade HTTP connections to WebSocket protocol for real-time bidirectional communication
- The client must send 'Upgrade' and 'Connection: Upgrade' headers in the initial HTTP request
- Server responds with 101 status code and specifies the new protocol in response headers
- Approximately 90% of modern real-time web applications rely on WebSocket protocol upgrades via 101 Switching Protocols
Overview
The 101 Switching Protocols is an HTTP status code that represents the server's acceptance of a protocol change request from the client. When a client needs to upgrade from the standard HTTP protocol to a different protocol, it sends a request with specific headers indicating this desire. The server can then respond with a 101 status code, signaling its willingness to switch protocols and proceed with the new communication method.
This status code was introduced as part of the HTTP/1.1 specification and is formally defined in RFC 7231, released in June 2014. The 101 response is a fundamental mechanism that enables modern web technologies such as WebSocket connections, which provide real-time, bidirectional communication between clients and servers. Understanding 101 Switching Protocols is crucial for developers working with real-time applications, chat systems, live notifications, and any technology requiring persistent, full-duplex connections.
How It Works
The 101 Switching Protocols process follows a specific handshake mechanism where the client initiates the request and the server decides whether to accept the protocol change. The entire exchange relies on HTTP headers that communicate the intent and acceptance of the protocol upgrade. Here are the key components and terms involved in this process:
- Upgrade Header: The client includes an Upgrade header in its HTTP request to specify the desired protocol, such as "websocket" or "h2c" (HTTP/2 over cleartext). This header explicitly tells the server which protocol the client wishes to switch to.
- Connection Header: The client must include a Connection: Upgrade header to indicate that the connection should be upgraded. This header is essential for the server to recognize that a protocol change is being requested.
- 101 Response Code: When the server accepts the upgrade request, it responds with a 101 status code along with corresponding headers. This response indicates that the server has successfully switched to the requested protocol.
- Protocol-Specific Handshake: After receiving the 101 response, the client and server perform a handshake specific to the new protocol. For WebSocket, this involves additional headers like Sec-WebSocket-Key and Sec-WebSocket-Accept to establish security and verify the connection.
- Persistent Connection: Once the protocol switch is complete, the underlying TCP connection remains open and is reused under the new protocol's rules. This eliminates the overhead of establishing new connections and enables efficient, continuous communication.
Key Details
Understanding the technical specifications and requirements of 101 Switching Protocols helps developers implement reliable protocol upgrades. The following table outlines the key characteristics and aspects of this HTTP status code:
| Aspect | Details |
|---|---|
| Status Code | 101 (Informational class, 1xx range) |
| HTTP Version | HTTP/1.1 and later versions |
| RFC Reference | RFC 7231 (Hypertext Transfer Protocol) |
| Common Use Case | WebSocket protocol upgrades and HTTP/2 upgrades |
| Security Requirement | HTTPS required for WebSocket Secure (WSS) connections |
The 101 status code is part of the 1xx Informational class of HTTP responses, which indicates that the request has been received and the server is processing it. Unlike the more common 2xx success codes, 101 specifically signals a protocol transition rather than the completion of a standard HTTP request. The server must support the requested protocol before responding with a 101 status; otherwise, it should respond with a 400 Bad Request or 426 Upgrade Required status code instead.
Why It Matters
- WebSocket Support: The 101 status code is the foundation for WebSocket connections, which power real-time chat applications, live notifications, collaborative editing tools, and multiplayer games. Approximately 90% of modern real-time web applications rely on this protocol upgrade mechanism.
- Reduced Latency: By establishing a persistent, full-duplex connection, 101 Switching Protocols eliminates the overhead of repeated HTTP request-response cycles. This significant reduction in latency is essential for applications requiring near-instant data delivery and user responsiveness.
- HTTP/2 Upgrade Path: The 101 mechanism enables servers to upgrade connections from HTTP/1.1 to HTTP/2 using the "h2c" protocol specification. This upgrade path allows for improved performance through multiplexing and compression while maintaining backward compatibility.
- IoT and Real-Time Systems: Internet of Things devices and real-time sensor networks depend on efficient, persistent connections for continuous data streaming. The 101 Switching Protocols provides the mechanism for establishing these long-lived connections without excessive bandwidth consumption.
The ability to switch protocols at runtime makes web applications more flexible, responsive, and capable of handling modern communication patterns. As real-time interactions become increasingly important in web applications, the 101 Switching Protocols status code remains a cornerstone of contemporary web architecture. Developers who understand and properly implement protocol upgrades can build more efficient, responsive applications that meet the demands of today's users.
More What Is in Technology
Also in Technology
More "What Is" Questions
Trending on WhatAnswers
Browse by Topic
Browse by Question Type
Sources
- RFC 7231 - HTTP/1.1 Semantics and ContentIETF Trust License
- MDN Web Docs - 101 Switching ProtocolsCC-BY-SA-2.5
- RFC 6455 - The WebSocket ProtocolIETF Trust License
Missing an answer?
Suggest a question and we'll generate an answer for it.