1011xx Informational

Switching Protocols

HTTP status code 101 Switching Protocols is used to indicate that the server is switching protocols in response to a client request

This status code is typically used when the client has requested an upgrade to a different protocol, such as switching from HTTP to WebSocket

It signals that the server has acknowledged the client's request and is switching to the new protocol, allowing for a seamless transition between the two protocols

It is an agreement between the client and server to change the communication protocol to one more suitable for the current need. This could involve upgrading from HTTP/1.1 to HTTP/2 or switching from a non-secure to a secure WebSocket connection (ws to wss).

The server communicates its approval for the protocol switch by sending this response, followed by opening the new protocol's connection. This mechanism is particularly beneficial for optimizing performance and enhancing security by allowing the use of more efficient or appropriate protocols as needs evolve throughout a connection.