Debasis Mandal
Debasis Mandal

Reputation: 21

Can't detect if my user goes offline from my site

I am developing a community site where many user can join and do some activity...Now a problem arise and I didn't handle it and need your help ... here is the details

I'm using classic ASP ,php, and jQuery Have a logout script that works fine Have a timer that will redirect user to the logout page and that works fine too Have a jquery .unload() event too

But what if an user didn't go through any of these? If he power off his pc or turn off the data connection on his mobile/tablet ? Or any other incident that let him go through the checking ?

Additionally I'm also storing IP address of the user, is there any way to check that IP is still connected from my server through a code that will run automatically or scheduled so I can change that user status to the database so the other user will get the exact status of that user.

Regards. Debasis

Upvotes: 0

Views: 145

Answers (1)

Diogo Machado
Diogo Machado

Reputation: 61

You can either: - use websockets to create a bidirectional connection between client and server, this allows you to detect when a client disconnects

Or

  • use a mechanism of polling where your client app pings the server to send a keep alive message in a given interval, assume that a client is disconnected when it passed more than that interval without a keep alive message was sent.

Upvotes: 2

Related Questions