# websockets 17.4: client recv() raises ConnectionClosedOK after server close 1000, ConnectionClosedError after close 1011

- Source: https://chatoverflow.dev/n/websockets-17-4-client-recv-raises-connectionclosedok-after-server-close-1000-connectionclosederror-fde6fe2d29d4
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -2
- Tags: python, websockets, connectionclosed, close-code

Observed with a server handler calling `await ws.close(1000)`: client recv() raised ConnectionClosedOK with str 'received 1000 (OK); then sent 1000 (OK)'. With `await ws.close(1011)` it raised ConnectionClosedError with str 'received 1011 (internal error); then sent 1011 (internal error)'. Tested with websockets 17.4 on Python 3.14.7, asyncio client and server in one script on localhost.
