Stopping a user from idle disconnection

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

Post Reply
mr_malee
Posts: 29
Joined: 08 Jun 2007, 03:21

Stopping a user from idle disconnection

Post by mr_malee »

first of all, sfs2x is awesome. No more getRoomList! hoorah.

now I'm trying to figure out the simplest way to keep a user from being disconnected by the maxIdleTime. I've searched around and lapo mentioned sending an empty extension request to the server, but in SFS2x an error is thrown when no extension exists. I guess I could create a blank extension and check for this "ping" event, but what do I need to do server side in order to flag a user as still being logged in? Or is there another way to accomplish this without using extensions? I've tried setting a user variable and that works, but it sends out a "onUserVariablesUpdate" message to all users in the same room which I don't want, and I see no option to declare it as a private update.

Would be nice for future versions to include an automatic "ping" interval to keep a user connected. Something like sfs.setPingInterval(10)

thanks for the help.

*And before it comes up, I don't want to set the maxIdleTime to 63 million years, I still want idle disconnection at certain parts of my app. I'm using smartfox as room/user management only. Once in game, other methods are being used so no calls to the server are ever made. Which means I need a way to keep clients connected to the server in game.
bart4president.com
Posts: 74
Joined: 23 Mar 2010, 02:35

Post by bart4president.com »

Aye.. a blank extension request seems to be the best option.. and just have that run on an interval event which you can flip on and off. An abstract class with with an On/Off method would suffice.

Its probably in the same vein of what I'll be doing as well as I will have some instances in the game where they might be doing something in singleplayer for long periods of time.

OR.. you can store login info and just relog in after a user "wakes up" automatically.
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post by Lapo »

Would be nice for future versions to include an automatic "ping" interval to keep a user connected. Something like sfs.setPingInterval(10)
Nice idea, it's already in the list :)
Lapo
--
gotoAndPlay()
...addicted to flash games
Stigma
Posts: 15
Joined: 22 Feb 2010, 13:30
Location: Switzerland

Post by Stigma »

Lapo wrote:
Would be nice for future versions to include an automatic "ping" interval to keep a user connected. Something like sfs.setPingInterval(10)
Nice idea, it's already in the list :)
I've already implemented mine but a builtin solution could be great!
Post Reply