Tracks Home’s port of Bun corpus position 4218 (js/web/websocket/websocket-subprotocol-strict.test.ts).
Scope:
- reject comma-combined, duplicate, empty, and unoffered
Sec-WebSocket-Protocolresponse values - accept exactly one offered protocol and expose it on
WebSocket.protocol - close invalid negotiations with RFC 6455 code 1002 and reason
Mismatch client protocol - retain actionable
WebSocketSubprotocolErrorcontext: code, operation, phase, offered/received protocols, close metadata, cause, and source-aware stack - validate both raw socket and Bun-listener handshake paths
Acceptance evidence:
- 18 passing tests
- 0 todos
- 0 failures
- 0 unsupported cases
- 0 allowed-empty cases