Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
closing browser...
#1
Hello,

How to close user session if the user close the browser…

With best regards,
Mikey
Reply
#2
Hi, IW does it for you automatically.
Reply
#3
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.
Mikey
Reply
#4
Correct. A timeout is the only reliable way to do this.
Reply
#5
(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.
Mikey

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.

Dan
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)