-
-
Notifications
You must be signed in to change notification settings - Fork 689
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Bug Description
- client sends
Sec-WebSocket-Protocolheader 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
undici/lib/web/websocket/connection.js
Line 179 in c49058b
| if (secProtocol !== null && secProtocol !== request.headersList.get('Sec-WebSocket-Protocol')) { |
Reproducible By
let ws = new WebSocket('ws://server...', ['msgpack', 'json'])
ws.addEventListener('error', e => console.log(e.error))
// server choses json and responds with `Sec-WebSocket-Protocol: json`
// client failedExpected Behavior
Correct subprotocol check
Environment
- Node.js v21.6.2
--experimental-websocketflag
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working