taoensso / sente

Realtime web comms library for Clojure/Script
https://www.taoensso.com/sente
Eclipse Public License 1.0
1.73k stars 193 forks source link

Scaling sente server for a few instances #410

Closed khmelevskii closed 1 year ago

khmelevskii commented 1 year ago

I need to support a lot of concurrent web-sockets connection and scale server. To implement this I have:

  1. HA-proxy on top of WS services with configured sticky session.
  2. I need to send message from to clients from all servers. For example: I have an app with 10 online users. On backend side I have 2 ws servers. 7 users were connected to server1 and 3 users to server2. When somebody generate event and server1 catch this event first and send response to all his 7 connected clients. But users from server2 will not receive their messages because server1 already handled event. I need to have something like this https://socket.io/docs/v4/adapter/ What you can recommend to do with sente for it?
ptaoussanis commented 1 year ago

@khmelevskii Hi Yurii,

I need to send message from to clients from all servers.

Sorry, could you please rephrase?

What you can recommend to do with sente for it?

If I understand correctly that you'd like every Sente server to broadcast something to all of its connected clients, I'd suggest that this is something outside the scope of Sente.

Common solutions might involve some kind of Pub/Sub system (e.g. Redis) that can broadcast such an instruction to all servers.

Hope that helps!

khmelevskii commented 1 year ago

Sure, it can be implemented using rebitmq or kafka. And in general I think it's a good idea to have it outside of Sente scope. Thank you