user idle time out event

Post here your questions about Actionscript and Java server side extensions development.

Moderators: Lapo, Bax

Post Reply
grrava
Posts: 10
Joined: 14 Dec 2011, 10:46
Location: Belgium
Contact:

user idle time out event

Post 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
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Post 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.
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
grrava
Posts: 10
Joined: 14 Dec 2011, 10:46
Location: Belgium
Contact:

Post 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.
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Post 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.
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
grrava
Posts: 10
Joined: 14 Dec 2011, 10:46
Location: Belgium
Contact:

Post 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!
Post Reply