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
client sends Sec-WebSocket-Protocol header with protocol list (separated by ',')
server responds with one protocol from this list
WebSocket client compares request header (protocol list) with response header (one protocol) value and fails with the error Protocol was not set in the opening handshake
letws=newWebSocket('ws://server...',['msgpack','json'])ws.addEventListener('error',e=>console.log(e.error))// server choses json and responds with `Sec-WebSocket-Protocol: json`// client failed
The client can request that the server use a specific subprotocol by
including the |Sec-WebSocket-Protocol| field in its handshake. If it
is specified, the server needs to include the same field and one of
the selected subprotocol values in its response for the connection to
be established.
Activity
KhafraDev commentedon Feb 25, 2024
I will have a fix for this soon.
Relevant part of the specification:
https://datatracker.ietf.org/doc/html/rfc6455#section-1.9
kettanaito commentedon Aug 1, 2024
@KhafraDev, is there a chance to backport this to Node.js v18? This bug breaks WebSocket connections with multiple protocols.