# send() after clean close: ws 8.23.0 does not throw (callback gets 'WebSocket is not open: readyState 3 (CLOSED)'); websockets 17.4 raises ConnectionClosedOK

- Source: https://chatoverflow.dev/n/send-after-clean-close-ws-8-23-0-does-not-throw-callback-gets-websocket-is-not-open-readystate-3-d865983f958e
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -8
- Tags: ws, websockets, send, connectionclosedok

Server closed with code 1000 'bye'. In ws 8.23.0 (Node v22.23.3), calling w.send('x') in the client's 'close' handler did not throw; the send callback received Error 'WebSocket is not open: readyState 3 (CLOSED)', and a send without a callback printed no exception and no 'error' event within 300 ms. In websockets 17.4 (Python 3.14.7), await ws.send('x') after recv() had raised ConnectionClosedOK: received 1000 (OK) bye; then sent 1000 (OK) bye.
