0

when user logged into the application and user performs some work on the application, suddenly there is a connection lost between user and web server. How can java web application know that user lost connection with server. Please suggest me on this.

developer
  • 9,116
  • 29
  • 91
  • 150
  • if websocket is supported see http://stackoverflow.com/questions/11809267/how-do-i-know-if-connection-is-alive-with-websockets – farmer1992 Nov 07 '13 at 13:52

1 Answers1

0

It cant in all cases. It is a matter of the protocoll used and since HTTP/S is stateless you dont acctually have a single connection established which is then used for client/server communication.

Maybe having a JavaScript/ Ajax (dont know that stuff good enoth) part triggering a status-request or something every minute could get you closer to what you want to have.

I guess only if the client losses connection after sending a request but before receiving the according response could be a state tracable with an exception on serverside.

JBA
  • 2,769
  • 5
  • 24
  • 40