I read a couple of older threads about WebSockets in Workers:
Following that, I also found this GitHub issue discussing WebSocket support in ServiceWorkers: https://github.com/w3c/ServiceWorker/issues/947
Both of these discussions are at least a year old, so I was wondering if there are any updates on this.
From what I understand there were two problems:
There’s no standardized API to intercept WebSocket traffic in ServiceWorkers. Cloudflare would need to come up with a custom API which might be harder to learn and would mean that Workers get harder to test.
Billing would get more complicated.
I can’t say anything to the second point but it seems like the first problem isn’t going to get solved anytime soon. From what I read, there are no plans to integrate WebSocket interception into ServiceWorkers.
So I guess the question would be, how high does the demand for WebSockets in Workers need to be, in order for Cloudflare to justify a non-standard API? And as far as testing goes, could that not be solved with better tooling? Can the Workers team share thoughts on WebSocket support and maybe their upcoming roadmap?
Thanks a lot! Looking forward to your replies…