Summary
When an OxyRoute worker shuts down (__rsgi_del__ / on_shutdown), active WebSocket connections are currently abruptly severed without a clean closing handshake. Connected clients receive unexpected TCP drops rather than a standard 1001 Going Away closure code.
Proposed Changes
- Track active
WebSocket connection instances in a registry within AppState (or WebSocket manager).
- During
on_shutdown, iterate through active connections and send a 1001 close frame before tearing down the worker.
- Add a graceful shutdown test for WebSocket clients.
Acceptance Criteria
- Connected WebSocket clients receive a clean 1001 close frame when the application shuts down.
Summary
When an OxyRoute worker shuts down (
__rsgi_del__/on_shutdown), active WebSocket connections are currently abruptly severed without a clean closing handshake. Connected clients receive unexpected TCP drops rather than a standard1001 Going Awayclosure code.Proposed Changes
WebSocketconnection instances in a registry withinAppState(or WebSocket manager).on_shutdown, iterate through active connections and send a1001close frame before tearing down the worker.Acceptance Criteria