When a session closed (the peer's WT_CLOSE_SESSION, or this end's), the mux's
reader stopped reading at once; the writer then sent its Close and the socket
went. A browser sends its WebSocket Close right after its CLOSE_SESSION, so
that frame was still unread when the socket was shut, and a socket shut with
unread bytes is reset rather than closed. WebKit reports the reset on the
console ("WebSocket connection to ws://…/moq failed: Socket is not
connected"), which failed WAI Studio's "no console error" check in WebKit on
macOS after its pre-call test (which opens the relay's binding, waits for
SETUP and closes). Counted per step: no error after leaving the room, one after
the pre-call test.
The reader now reads on after the close, discarding, until the peer ends the
pipe or for at most 2 s, so the closing handshake finishes and the socket
closes cleanly.
Co-Authored-By: Claude Opus 5.5 <[email protected]>