14

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.

George Mauer
  • 117,483
  • 131
  • 382
  • 612
  • Check this [article](http://www.asp.net/signalr/overview/guide-to-the-api/mapping-users-to-connections). It's good start what you want to do. – Erkan Demirel May 01 '16 at 01:29

1 Answers1

15

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

Community
  • 1
  • 1
Florin Secal
  • 931
  • 5
  • 15
  • 4
    Yep, this is what we do. Also on OnReconnected() we replace clients. It's basically a Dictionary keyed by Connection ID. I sure do wish we could access the internal list, but all the docs I have seen indicate that this is how to do it. – Daniel Williams Jun 17 '16 at 23:32