Page 1 of 1

Preventing idle timeout on moderators

Posted: 25 Jan 2011, 23:35
by vazor
smartfox version 1.6.8
java version 1.6.0_21

Do moderators get kicked after idle timeout?

I searched around in the docs and forums but I did not see anything saying one way or the other. Even with the quote below it is still not clear...

http://forums.smartfoxserver.com/viewto ... moderators
nespe11 wrote:I´m trying to log the clients as Moderators to avoid that the smartfoxserver kick them.

Well I tried it on my own and seems like they do get disconnected after the time in MaxUserIdleTime has expired.

So I wanted to prevent moderators from being kicked. After some searching I saw the updateMessageTime() function, and decided to try that. I am calling it in a timer like this:

Code: Select all

keepAliveTimer.schedule(new KeepModeratorsAliveTimer(this), 0, 15000);
and in KeepModeratorsAliveTimer I simply call the updateMessageTime() function on users that are moderators. This is of course all server-side and in java.

Hope this helps someone, also let me know if there is something bad with how I am doing this. Thank you!

Posted: 26 Jan 2011, 19:18
by BigFIsh
Does your updateMessageTimer method send a empty message to the server? Also you need to keep calling that function within the MaxUserIdleTime limit.

So for example, if your MaxUserIdleTime was 60000ms - you should call updateMessageTimer every 55000ms or so.

Posted: 26 Jan 2011, 21:01
by vazor
updateMessageTime() is a function in the smartfox java server API - on the User class. It doesn't need to send anything to the server, it just prevents the idle disconnect in smartfox for the users I call the function on repeatedly. I read that it might be overall better to actually send something, but this way keeps down on traffic since it is all server-side. I am fine with the client getting disconnected for other network related reasons.

Anyway yes the function is called within the MaxUserIdleTime limit. 15000 is less than our timeout 20000. That's how the java Timer.schedule() function works I think.