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/
Screenshot_2024-10-01_at_6.13.47_PM.png
Cloudflare 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.
Was this page helpful?