Skip to content

Fix WebSocket send after client disconnect - #2318

Open
ahmedoubadi wants to merge 1 commit into
unclecode:mainfrom
ahmedoubadi:fix/websocket-disconnect
Open

ahmedoubadi wants to merge 1 commit into
unclecode:mainfrom
ahmedoubadi:fix/websocket-disconnect

Conversation

@ahmedoubadi

Copy link
Copy Markdown

What this fixes

The monitor WebSocket could continue running after the client disconnected.

This caused:

RuntimeError: Unexpected ASGI message 'websocket.send', after sending 'websocket.close'.

The WebSocket handler now:

  • Stops the monitoring loop when WebSocketDisconnect occurs
  • Handles the RuntimeError caused by sending after the socket is closed
  • Avoids retrying sends on an already-closed connection

File changed

deploy/docker/monitor_routes.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant