101 Switching Protocols
The HTTP101 Switching Protocolsinformational response status code indicates the protocol that a server has switched to.The protocol is specified in theUpgrade request header received from a client.
The server includes anUpgrade header in this response to indicate the protocol it has agreed to switch to.The process is described in detail in theProtocol upgrade mechanism guide.
In this article
Status
101 Switching ProtocolsExamples
>Switching protocols to WebSockets
The following example shows how switching protocols might be used withWebSockets.A client sends aGET HTTP request with anUpgrade header which must also be listed in theConnection header.The server agrees to switch protocols, returning a 101 response meaning the connection has switched from HTTP to WebSocket.At this point, the client and server can now start exchanging WebSocket data.Information about how to setSec-WebSocket-* headers for handshake negotiation can be found inWebSocket-specific headers.
GET /notifications HTTP/1.1Host: example.comUpgrade: websocketConnection: UpgradeHTTP/1.1 101 Switching ProtocolsUpgrade: websocketConnection: UpgradeSpecifications
| Specification |
|---|
| HTTP Semantics> # status.101> |