rebus-org / Rebus.SignalR

:bus: Rebus-based SignalR backplane
Other
29 stars 6 forks source link

[Question] Keeping track of the number of users/connections in a certain group #10

Closed ryanbuening closed 4 years ago

ryanbuening commented 4 years ago

Is there a way to utilize Rebus.SignalR to determine the number of users/connections for a specific group when behind a load balancer?

I initially tried setting up a ConcurrentDictionary of connections with the key being the ConnectionId and including the GroupName for each connection (adding/removing as necessary). However, this solution doesn't work when behind a load balancer as the ConcurrentDictionary isn't shared across servers.

I could setup some persistence via a SQL table. But before I did that I thought I'd see if I might be overlooking something that Rebus.SignalR provided that would help.

ryanbuening commented 4 years ago

The comments on this StackOverflow answer describe the situation.

rsivanov commented 4 years ago

You need to have some centralized storage to count all the connections when behind a load balancer. Rebus.SignalR doesn’t provide this storage itself, so an SQL table is the correct way to go.