Stopping a user from idle disconnection
Posted: 15 Nov 2010, 23:14
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.
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.