Idle timeouts
Idle timeouts
Hey all... what is the officially recommended way to make the SFS receive a client request but *not* reset the idle timeout clock? I want to be able to send a client request but have the SFS ignore the request from the idle timeout perspective and just keep the clock counting down. I see several different options in the User class and ISession but do not know which is appropriate for this purpose.
Re: Idle timeouts
There isn't a way to do this. Every command sent to the server will reset the timeout clock.
Can you explain what would be the use case?
Can you explain what would be the use case?
Re: Idle timeouts
Hi Lapo. Sure... the use case is an implementation of a basic network time protocol as seen here http://en.wikipedia.org/wiki/Network_Time_Protocol#Clock_synchronization_algorithm. The sync request is made by the client every few minutes, in effect destroying idle timeouts and for this reason I wanted to have the SFS selectively ignore/circumvent any sync request timeout resets. I pondered that perhaps doing something like user.setLastRequestTime(user.getLastRequestTime()) would suffice but I also considered it might be an unexposed mechanism and came here to find out. The problem is the client must be the initiator so it can keep track of request/response packet's time-of-flight and correct for network latency... is there some way of implementing a network time sync protocol and still keep idle timeouts working?
Re: Idle timeouts
Code: Select all
user.setLastRequestTime(user.getLastRequestTime())
This will not work because the User timer is updated by the server. Whether it does it before or after your Extension handler (I should check) your code will not override it.
There are a couple of simple alternatives:
1) Implementing the idle-disconnection on the client side
2) Setting the User idle timer to a value shorter than the clock request so that when the player becomes inactive it will be properly detected.
Hope it helps
Re: Idle timeouts
Theoretically you could use a servlet container that is bundled with sfs to synch the clocks and make sync request to plain old servlet instead of smatfox. this would keen idle timeout intact.
We do not use jetty that ships with smarfox but a seperate instance of tomcat but idea should be the same.
We do not use jetty that ships with smarfox but a seperate instance of tomcat but idea should be the same.
Re: Idle timeouts
That is actually a good idea too.
Thanks
Thanks
Re: Idle timeouts
Levancho - At your suggestion I just learned how to make a servlet (didn't know anything about them before) and have the SFS Jetty serving up a time sync, circumventing the SFS timeout reset and giving me exactly what I need. Thank you very much!
For anyone else who is a new to this: If you want to make a servlet to run on the included web server get started here: http://www.seas.upenn.edu/~cis330/jetty.html. The directory of interest with SFS is SmartFoxServer2X/SFS2X/www/ instead of "webapps" as the tutorial uses.
You will also need the the Jetty servlet api for the version that SFS runs (currently 6.1.26... correct me if this is incorrect). Get it from here: http://dist.codehaus.org/jetty/jetty-6.1.26/jetty-6.1.26.zip
For anyone else who is a new to this: If you want to make a servlet to run on the included web server get started here: http://www.seas.upenn.edu/~cis330/jetty.html. The directory of interest with SFS is SmartFoxServer2X/SFS2X/www/ instead of "webapps" as the tutorial uses.
You will also need the the Jetty servlet api for the version that SFS runs (currently 6.1.26... correct me if this is incorrect). Get it from here: http://dist.codehaus.org/jetty/jetty-6.1.26/jetty-6.1.26.zip
Re: Idle timeouts
The servlet API is already provided with SFS2X under the lib/jetty/ folder.
Thanks
Thanks
Who is online
Users browsing this forum: No registered users and 73 guests