You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `handshakeResponse` object contains the HTTP response that upgraded the connection to WebSocket:
193
+
The `handshakeResponse` object contains the HTTP response that established the WebSocket connection:
194
194
195
-
-`status` (number): The HTTP status code (101 for successful WebSocket upgrade)
196
-
-`statusText` (string): The HTTP status message ('Switching Protocols' for successful upgrade)
195
+
-`status` (number): The HTTP status code (`101` for HTTP/1.1 upgrade, `200` for HTTP/2 extended CONNECT)
196
+
-`statusText` (string): The HTTP status message (`'Switching Protocols'` for HTTP/1.1, commonly `'OK'` for HTTP/2 in Node.js)
197
197
-`headers` (object): The HTTP response headers from the server, including:
198
+
-`sec-websocket-accept` and other WebSocket-related headers
198
199
-`upgrade: 'websocket'`
199
200
-`connection: 'upgrade'`
200
-
-`sec-websocket-accept` and other WebSocket-related headers
201
+
202
+
The `upgrade` and `connection` headers are only present for HTTP/1.1 handshakes.
201
203
202
204
This information is particularly useful for debugging and monitoring WebSocket connections, as it provides access to the initial HTTP handshake response that established the WebSocket connection.
0 commit comments