xintercept
CDCloudflare Developers
•Created by xintercept on 1/9/2025 in #workers-help
Errors with Durable Object websockets disconnecting
Context: We terminate websockets in our workers, and maintain a websocket to durable objects while the session is active.
Recently (last 7 days) we've observed an elevated error rate in the websocket connection to the DOs, where they disconnect more frequently than they used to, and often fail to reconnect with a "Error: Network connection lost." when we retry.
Any advice or guidelines on what to do to diagnose this further? (Why are the DOs disconnecting so much?) Or the best thing to do when it does disconnect? (i.e. sleep for 1 second and retry 5 times)
Thanks!!
1 replies
CDCloudflare Developers
•Created by xintercept on 2/27/2024 in #workers-help
Websockets, Durable Objects & Subrequest Limits
Hey folks, I'm trying to design an application on Workers that involves long-lived Websockets. I want to proxy the websocket to another service (hosted off of CF) and I want to forward a copy of all the messages that go over the socket a Queue.
I have this working, but I run into subrequests limits with the Queue writes. After 1k message have been sent over the socket, we need to tear-down and re-establish the session be able to keep writing to the queue.
I'm thinking it may be possible to forward to the messages to a Durable Object (over a single websocket) and publish to the queue from there, but I'm not sure what subrequest limits would apply in this case.
Any idea if this would work? Or if there's another way of going about this?
2 replies
CDCloudflare Developers
•Created by xintercept on 1/29/2024 in #workers-help
How to know when subrequest limit is hit?
We have some long-lived (always on) websockets terminating on our worker, and it appears we lose communication to the outside world after some time. We were initially making HTTP calls out during the request. We've since moved that sending messages to a queue, and handling these with another worker. No change in behaviour though.
I suspect we're coming across subrequest limits. And it looks like calls to internal services are limited too (albeit with a higher limit).
How would I able to confirm that the subrequest limit was hit for a particular request? Is there a way to detect this while the worker is running?
2 replies