On 30 juin, 17:17, Jan Hančič <
jan.han...@gmail.com> wrote:
> Hi,
> define a unload event handler and make a AJAX call to your server, telling
> it the client is logging off. And send an updated list of present users
> trough a channel.
> Just make sure you make a synchronous AJAX request (some browsers do not
> allow asynchronous requests in the unload event).
>
> There will still be cases where you will have "zombie" users, because, for
> some reason or other, the unload event won't fire.
> I solved this so that every client updates it's last seen flag on the server
> every X minutes, and then I made a cron script that runs every X minutes and
> removes the "zombie" clients and sends a new list to connected clients.
>
> Hope this helps.
>
> --