How to catch websocket closed due to code changes

I have an internal system to count the number of session using KV, and this can break it if there are any active connections when code is deployed. Is there a way to catch this event? As far as I can tell the normal webSocketClose isn't called https://developers.cloudflare.com/durable-objects/reference/websockets/
Cloudflare Docs
Durable Objects with WebSockets | Cloudflare Durable Objects docs
WebSockets allow real time communication between a client and server. Both Cloudflare Durable Objects and Workers can act as WebSocket endpoints – either as a client or as a server.
No description
1 Reply
_matt_
_matt_3w ago
Were you able to solve this? I'm also curious how to manage active websocket connections (in my case on Durable Objects) when new code is deployed

Did you find this page helpful?