Last post May 24, 2016 02:02 AM by Fei Han - MSFT
May 23, 2016 03:53 PM|smcneese|LINK
I keep track of my connections in a ConcurrentDictionary using the OnConnect, OnDisconnetc, etc. of the hub. However, I found situations where my concurrentdictionary gets out of sync with the hub connections. I have not figured out why but the result
is that I end up with connections in my concurrentdictionary which are not longer valid connections on the hub. This is the problem with trying to manage a secondary list for something that should be accessible from the Clients hubproxy.
Does anybody know how to see if a connection id exists in the hub? What I would like to do is have a Cleanup routine running that periodically iterates the list of connections in my concurrentdictionary and verifies that the hub still has that connection.
May 24, 2016 02:02 AM|Fei Han - MSFT|LINK
Does anybody know how to see if a connection id exists in the hub?
As far as I know, each client connecting to a hub has a unique connection id, are you sure that there are same connection id in your dictionary? If you’d like to check if a connection id already exists in dictionary, you could loop through dictionary to
check if same connection id has been stored in dictionary before you add a client connection id in dictionary.