C # WCF MySQL tracks concurrent users

What is a good way to track connected users on my WCF server. EX: I have user accounts, each of which has use sessions. If a user has 100 sessions registered in his account, he can connect 100 times from the same username. Connection tracking is straightforward. But what about tracking if the user disconnects? How can a server be notified when a TCP connection to an end user is complete?

I create a handler when the channel closes. But how can I now match something in the sender / EventArgs with meaningful connection data.

OperationContext.Current.Channel.Closed += _Closed; private void _Closed(object sender, EventArgs e) { } 
+4
source share
1 answer

You can save your connection channels in the dictionary when the connection is created and delete it in this event. so you can track concurrent users;)

0
source

Source: https://habr.com/ru/post/1444967/


All Articles