How do I proxy WebSocket requests?

My team has some technical questions that the official docs are not very clear about it.

Searching in the knowledge base resulting a simple yes,

Is there any examples on how we could implement a simple proxy for WebSockets?

This blog post by a user who asked the same question should help: Cloudflare Workers & WebSockets. High speed, realtime messaging at the edge.

If you have more questions about it, he’s active on the Discord and there’s other people there too who can probably help.

Thanks for replying.

Let me add to the context about what we want to do here, we only want to dynamically proxy the WebSocket to geographical load-balancers and we don’t care about the content of the messages inside.

Base on my current understandings, if the domain being proxied is static, CloudFlare DNS does that transparently for me, for free.

So I am guessing that I don’t have to maintain active sessions of WebSocketPairs in the worker and pipe them together, which is implied by the blog post you shared. At least that’s what I am hoping for.

Am I correct?

This post was flagged by the community and is temporarily hidden.