HACKER Q&A
📣 pabs3

WebSocket Relay?


Does anyone know of a tool that can be used to connect to a WebSocket server and relay all messages from it to each of the clients of the relay?

There is an overloaded WebSocket server I often want to access with lots of clients, but I would like to reduce my load on the server to one client and then connect other clients to that one client.


  👤 solardev Accepted Answer ✓
You might be able to build something like that in serverless, if you wanted to: https://blog.cloudflare.com/introducing-websockets-in-worker... (and updated keep-open pricing in https://blog.cloudflare.com/workers-pricing-scale-to-zero/)

Or here's a writeup about writing a proxy in Node: https://sensepost.com/blog/2015/another-intercepting-proxy/


👤 cookiengineer
WebSocket servers are just long lived HTTP connections after the "Upgrade" mechanism. So pretty much any modern programming language would do the trick.

I've made an extensive writeup of the WS13 protocol in case you want to implement it, with lots of example code:

[1] https://cookie.engineer/weblog/articles/implementers-guide-t...


👤 digikata
Fluvio connectors can access websockets, stream events to a topic whose events can be consumed by multiple clients.

https://www.fluvio.io/connectors/inbound/http/

https://github.com/infinyon/fluvio

The websocket connection was recently added, so if you come up with any suggestions or other feedback on it feel free to share it with the project.


👤 syndicatedjelly