Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
closing browser...
(05-31-2018, 03:27 PM)Mikey29 Wrote: Hello JPN,

Yes after the session time is over…

I 'm looking for a way to force to end the session in order to free memory on the serveur…
But it seem's that there is no one, except waiting the time session is over…

Big thank you answer.

As stated, the way the session ends is with a timeout.  But, you do have some control over that timeout and how you manage session shutdown.  There are a couple of settings you want to look into.

The first is the session timeout setting itself.  You can set it as a ServerController property or at runtime as, for example, ASession.SessionTimeout in ...BaseNewSession event.  You can shorten the timeout considerably so that when the form is closed the session will end much sooner.

The second setting to consider is IWForm.KeepAlive.  Note that this is NOT the HTTP KeepAlive.  If you set the Form.KeepAlive to true then the form will "ping" the server to keep the SessionTimeout from occurring.  It pings 3 or 4 times during the SessionTimeout period so the shorter the timeout, the more often it pings. This setting is in each form, so must be set for the form.

By combining these two you can have the session open for as long as you want, but close fairly quickly when the form disappears. 

A caveat... some browsers stop processing when they lose focus, so the KeepAlive does not execute.  So far as I know only mobile browsers behave this way.  I use a different timeout based on whether a browser is mobile or not.


Messages In This Thread
closing browser... - by Mikey29 - 05-30-2018, 10:15 PM
RE: closing browser... - by Jose Nilton Pace - 05-31-2018, 02:52 PM
RE: closing browser... - by Mikey29 - 05-31-2018, 03:27 PM
RE: closing browser... - by DanBarclay - 05-31-2018, 04:54 PM
RE: closing browser... - by kudzu - 05-31-2018, 04:00 PM

Forum Jump:

Users browsing this thread: 1 Guest(s)