User maximum idle time

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
PanagiotisMilios
Posts: 34
Joined: 22 Jan 2023, 21:48

User maximum idle time

Post by PanagiotisMilios »

Can i have a separate user maximum idle time for only a specific user?

In my use-case, i have a .net web api client connected to the server and it's critical to remain connected and not have disconnections. Can i somehow set it with an extension during login for instance?
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: User maximum idle time

Post by Lapo »

Hi,
yes and no :)
No in the sense that the "max idle time" is the same for everyone in the Zone, but also Yes: you can simply make sure that the client sends a small request every now and then to keep the connection alive and never get disconnected for being idle.

There's two ways to do this:
1) via the LagMonitor from the client API. By simply turning it on, it will send a ping/pong request every 4 seconds. You also need to turn on the "Enable Keepalive" option in the Zone via AdminTool > Zone Configurator. (By default pings are not used to keep the connection alive)

2) via a custom Extension call, similar to a ping/pong request.

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
PanagiotisMilios
Posts: 34
Joined: 22 Jan 2023, 21:48

Re: User maximum idle time

Post by PanagiotisMilios »

I see. thanks a lot!
PanagiotisMilios
Posts: 34
Joined: 22 Jan 2023, 21:48

Re: User maximum idle time

Post by PanagiotisMilios »

Another bump here. Is doing from the client api

Code: Select all

sfs.EnableLagMonitor(true);
enough?
Because i tried it but it dropped the connection after a few minutes. I've also enabled the keep alive option in the zone and restarted the server.
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: User maximum idle time

Post by Lapo »

Check the logs and see if there's a message relative to that User that was kicked for being idle.
If the config was done correctly you should not find it. In which case it means that the client got disconnected due to bad network conditions.

To remedy some of those cases you should turn on the reconnection system:
https://docs2x.smartfoxserver.com/Getti ... n-hrc-plus

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
PanagiotisMilios
Posts: 34
Joined: 22 Jan 2023, 21:48

Re: User maximum idle time

Post by PanagiotisMilios »

The error was that i was enabling it on the connection success callback but i read on the docs that it needs to be after the user is logged in. These things would be handy though to exist as comments inside the decompiled sfs files. Thanks for the reconnection link, i'll apply it although both my servers are in the same private network so random disconnects should be exrtemely rare.
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: User maximum idle time

Post by Lapo »

If you enable the LagMonitor before having successfully logged in, you will get a warning message in your client side logs.
As regards unexpected disconnections in a local network I agree they should never happen. Not even rarely, unless the there's some weird technical issue in the network or some local software (firewall?) that interferes.

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
PanagiotisMilios
Posts: 34
Joined: 22 Jan 2023, 21:48

Re: User maximum idle time

Post by PanagiotisMilios »

I must have missed it then because at the same time the web server starts and logs all the initial messages.
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: User maximum idle time

Post by Lapo »

I am referring to a warning message in the client side logs.
For example in Java or C# (client) you'll get a "Lag Monitoring requires that you are logged in a Zone" message.

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
PanagiotisMilios
Posts: 34
Joined: 22 Jan 2023, 21:48

Re: User maximum idle time

Post by PanagiotisMilios »

Yes, this specific sfs client runs as background service next to a .net web api. I meant the logs of my web server probably overshadowed that message
Post Reply