0

I've wcf service to which connect several clients. If one of them wants disconnect then end proxy session, notify other users etc etc

But sometimes client disconnects from wcf service unproperly (e.g. user ends his process). How to detect, this client is disconnected and notify other clients?

Saint
  • 5,397
  • 22
  • 63
  • 107
  • 1
    Please put more context here. What binding do you use? What is the contract? How do you detect a "proper" disconnection? This would help people to understand your question. – oleksii Jan 17 '12 at 12:00
  • Are you maintaining session object among different clients? – Amar Palsapure Jan 17 '12 at 12:00
  • @oleksii Proper disconnection is when users that going to disconnect send broadcast simple message list enum "ActionType.Disconnect". Problem is when process is just closed suddenly and it's does not have time to call this broadcast() – Saint Jan 17 '12 at 12:11
  • @AmarPalsapure session is only between client and service. Not between all clients. – Saint Jan 17 '12 at 12:14
  • Perhaps the answer to this SO question can help you: [http://stackoverflow.com/questions/5338842/detect-socket-disconnect-in-wcf][1] [1]: http://stackoverflow.com/questions/5338842/detect-socket-disconnect-in-wcf – Diego Jan 17 '12 at 13:59

1 Answers1

4

As clients disconnect abruptly you will not come to know on your service side if client is disconnected, so you will have to manually disconnect the user.

For this you will need to add LastAccessTime property in your session object. Once this in place you will have to write a back ground worker role which will disconnect the session on basis of LastAccessTime. In every request you will update this time with current time.

Hope this helps.

Amar Palsapure
  • 9,590
  • 1
  • 27
  • 46