Switching Protocols
1xx Informational
Last updated:
The server is switching protocols as requested by the client, typically to WebSocket.
Description
The server acknowledges an Upgrade header and switches the connection to a different protocol. This is the standard handshake response for WebSocket connections.
When to use
Return 101 during the WebSocket upgrade handshake, or when upgrading from HTTP/1.1 to HTTP/2 over the same connection (rare in practice).
Specification
RFC 9110 §15.2.2
Examples
HTTP response
HTTP/1.1 101 Switching Protocols
Content-Type: application/json
{"error":"Switching Protocols"}Node.js (Express)
res.status(101).json({ error: "Switching Protocols" });Go (net/http)
w.WriteHeader(http.StatusSwitchingProtocols)
Python (Flask)
return jsonify({"error": "Switching Protocols"}), 101