Page 1 of 1

user idle time out event

Posted: 06 Jan 2012, 09:40
by grrava
Hello,

I searched the net, the documentation and the forums, but i couldn't find an answer to this question:

I would like to receive an event on my server side room extension when a user has exceeded the max idle time, is that possible?

Thanks,
Alex

Posted: 06 Jan 2012, 21:25
by rjgtav
Hi.

Well, when an user is disconnected, independent from being idle or not, the server always fires an userLost event.

So, in this case, if you want to find out if the user was disconnected for being idle or not, i think the best way is to: When you get an userLost event, you get the user's last message time (the time he sent the last message to the server) by using the getLastMessageTime() method and then you check how much time has passed since then and if it is bigger or equal to the max time an user can be idle, so that user was disconnected for being idle.

Posted: 11 Jan 2012, 10:07
by grrava
In every room I have an extension the gets the USER_DISCONNECT event, if the given reason is idle or kick, I'd like to send a message to the user informing him of that fact, is there a way to do that? Since the user is already disconnected, the message should be send before that.

Posted: 11 Jan 2012, 17:23
by rjgtav
You can't send that message from the extension, as the user is already disconnected and won't receive it. What you have to do is to show that message client-side, maybe have a client-level counter which counts the amount of time that user has being idle and when you get the disconnect event, you check the time you have been idle.

Posted: 12 Jan 2012, 05:23
by grrava
Ok, since I can't send a message to the clients I asked the developers of the clients to properly implement the disconnected event handler :D

Thanks for the help!