Page 1 of 1

User maximum idle time

Posted: 12 Jan 2026, 09:38
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?

Re: User maximum idle time

Posted: 12 Jan 2026, 17:18
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

Re: User maximum idle time

Posted: 12 Jan 2026, 21:06
by PanagiotisMilios
I see. thanks a lot!

Re: User maximum idle time

Posted: 22 Jan 2026, 15:20
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.

Re: User maximum idle time

Posted: 22 Jan 2026, 16:38
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

Re: User maximum idle time

Posted: 23 Jan 2026, 12:05
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.

Re: User maximum idle time

Posted: 23 Jan 2026, 14:56
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

Re: User maximum idle time

Posted: 26 Jan 2026, 14:28
by PanagiotisMilios
I must have missed it then because at the same time the web server starts and logs all the initial messages.

Re: User maximum idle time

Posted: 26 Jan 2026, 14:54
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

Re: User maximum idle time

Posted: 26 Jan 2026, 18:41
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