1

My web application is in ASP.NET 4.0 C#, in which i have also use of WCF services and maintain session with create random userID. Application is about Video Management System. When I am request to start streaming to VSS(Video Streaming Server), at that time I will insert all streaming details for requested camera and user into SQL server table. And on disconnect the video streaming of that particular camera, i will remove that entry from table of that user only. Other users entry will be remaining as it is if others see the Live Streaming.

While any how some networks disconnected or browser crash this entry will not be clear. So i would like to know that how can I know that one client is disconnected and i need to clear its data mapping with that userID only using check that session of that user is alive or not, if not need to clear data from Sql table.

Please help me to solve this issue.

Jigs
  • 103
  • 1
  • 11
  • What exactly is the client which is connecting to this WCF service? Is it a browser? A WCF client? A HttpListenner? Some other type application? – tom redfern Feb 17 '16 at 11:35
  • Yes client is a browser. My Application also has silverlight pages, who uses WCF service to retrieve data. – Jigs Feb 17 '16 at 11:54

1 Answers1

1

The nature of communication over the network dicatates that you cannot interpret a lack of incoming IP packets as hard evidence that a client has crashed, moved somewhere else, gone for a cup of tea, or suddenly died.

To partially address this, you can:

  1. provide a Disconnect() operation which can be called to explicitly kill the session when the browser is closed or otherwise navigates away. Note, this is inherently unreliable.
  2. implement a reasonable session time-out for when the client just crashes

This is assuming you are making WCF calls from the browser.

Community
  • 1
  • 1
tom redfern
  • 30,562
  • 14
  • 91
  • 126
  • Thanks for reply. I have already put `$(window).bind('unload', function (unloadLiveView();) {});` and `` in my parent page, and it works fine on browse close as well as end task of browser. But while the case of **client's machine's notwork cable is unplugged or computer shutdown** is create issues. I found session alive from -[link](http://stackoverflow.com/questions/1431733/keeping-asp-net-session-open-alive), but it should call from WCF services, i find this way. If any how WCF services finds client session is no more. – Jigs Feb 17 '16 at 13:15