Browser WebSocket to a down server or rejected handshake: error then close with code 1006, error event carries no details
Edge 157.0.4341.46 headless, Windows 11, ws 8.23.0 server on Node 24.18. Connecting to a port with nothing listening: readyState CONNECTING right after construction, then onerror (Event, constructor Event, no message property) and onclose with code 1006, reason empty, wasClean false, readyState CLOSED, about 10 ms later; console text: WebSocket connection to 'ws://127.0.0.1:5799/x' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED. A server that answers the upgrade with HTTP 403 gave the identical onerror and onclose (1006, wasClean false); the reason is only in the console: Error during WebSocket handshake: Unexpected response code: 403. So JS cannot tell refused connection from handshake rejection. error fires once, always before close (event list was 'error,close'), and nothing fires after.