Good Morning, if I may ask, I have a question regarding a worker prototype I've recently built. Esse

Good Morning, if I may ask, I have a question regarding a worker prototype I've recently built. Essentially, it functions as a bundled worker serving as a WebSocket server 😆 [yes!]. It listens for incoming parameterized requests, looks up a value in KV, and returns the value via the WebSocket connection. Due to the inherent behavior of bundled workers having a 50 ms lifetime, the WebSocket connection is automatically closed or terminated. This behavior is intentional. I utilize the WebSocket connection to transmit data to the client in a manner that is intended to make data scraping (e.g., via REST) more challenging.

Now, here are my questions: How does a worker, in general, scale concerning WebSockets? Or is this a general inquiry regarding the behavior of bundled workers concerning concurrent connections? I'd like to determine how many parallel WebSocket connections/requests I could potentially serve, both in the free plan and the smallest paid plan initially. Additionally, I don't yet grasp whether it's my responsibility as a developer to spin up the appropriate number of workers myself or if this process is handled automatically by the Cloudflare infrastructure (meaning only one worker needs to be programmed, and the rest occurs automatically).
Was this page helpful?