Actually, you can not capture event like this, because there are so many scenarios.
But one way to achieve this, is to create a scheduler.
Let me explain it in detail.
- Create a scheduler at client side which will send a request to server.
- Create a scheduler at server side which will capture a request sent by client side.
Scheduler should be at some time interval.
This way you can know that your client is live. The moment you don't get any request from client side, you assume that client is disconnected.