ยฉ 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Cloudflare DevelopersCD
Cloudflare Developersโ€ข2y agoโ€ข
4 replies
Paul

How to maintain WebSocket client connections in Durable Object?

1) Would it be the correct understanding that in order to use the Durable Objects Hibernation API, I need to extends the DurableObject class?
2) If so, how can I delete a certain clientId on close? In the examples, it doesn't extend the DurableObject class so the handleWebsocketSession method is able to set listeners to delete clientConnectionIds. However, when extending the durableObject class, the webSocketClose and webSocketError methods handle the closing of the client, so I'm not able to refer to the same clientId anymore..

See code below:
Cloudflare Developers banner
Cloudflare DevelopersJoin
Welcome to the official Cloudflare Developers server. Here you can ask for help and stay updated with the latest news
85,042Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Durable object websocket connections
Cloudflare DevelopersCDCloudflare Developers / workers-and-pages-help
2y ago
websocket client in workers / durable object
Cloudflare DevelopersCDCloudflare Developers / workers-and-pages-help
15mo ago
Durable Object websocket 1006
Cloudflare DevelopersCDCloudflare Developers / workers-and-pages-help
3y ago
Durable object outgoing webSocket connection
Cloudflare DevelopersCDCloudflare Developers / workers-and-pages-help
2y ago