User maximum idle time
-
PanagiotisMilios
- Posts: 34
- Joined: 22 Jan 2023, 21:48
User maximum idle time
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?
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
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
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
-
PanagiotisMilios
- Posts: 34
- Joined: 22 Jan 2023, 21:48
Re: User maximum idle time
I see. thanks a lot!
-
PanagiotisMilios
- Posts: 34
- Joined: 22 Jan 2023, 21:48
Re: User maximum idle time
Another bump here. Is doing from the client api 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.
Code: Select all
sfs.EnableLagMonitor(true);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
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
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
-
PanagiotisMilios
- Posts: 34
- Joined: 22 Jan 2023, 21:48
Re: User maximum idle time
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
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
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
-
PanagiotisMilios
- Posts: 34
- Joined: 22 Jan 2023, 21:48
Re: User maximum idle time
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
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
For example in Java or C# (client) you'll get a "Lag Monitoring requires that you are logged in a Zone" message.
Cheers
-
PanagiotisMilios
- Posts: 34
- Joined: 22 Jan 2023, 21:48
Re: User maximum idle time
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