In my hub, how do I get a list of all currently connected connectionIds?
Essentially, I'm doing some encryption (yes, I've talked to a bunch of people and nothing built-in works) and have an instance of Aes
for each connection. So basically when I need to send a message to all clients I can't just do Clients.All
but rather must manually enumerate all clients, fetch its Aes encoder (by id) and then send a message to it.
Each client connecting to a hub passes a unique connection id. You can retrieve this value in the Context. ConnectionId property of the hub context.
The default keepalive timeout period is currently 20 seconds. If your client code tries to call a Hub method while SignalR is in reconnecting mode, SignalR will try to send the command. Most of the time, such attempts will fail, but in some circumstances they might succeed.
You'll have to build a way to store the connected clients by yourself using OnConnect() and OnDisconnect().
Get number of listeners, clients connected to SignalR hub
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With