Count the number of sessions opened

I need to count how many session I have opened at any moment.

What I had done is:

  1. I defined a property in the App named intSessionsOpened as integer

  2. In the Session.Open Event I placed a counter like this and a msgbox that if I start the app with the parameter ‘Admin’ it shows me how many sessions are opened:
    App.intSessionsOpened = App.intSessionsOpened + 1
    If Self.URLParameterCount > 0 Then
    if Self.URLParameterName(0)=“Admin” then
    msgbox str(App.intSessionsOpened)
    end if
    end If

  3. In the Session.Close Event I substruct 1 session like this:
    App.intSessionsOpened = App.intSessionsOpened - 1

The problem is that when I start the app in my browser and I close the browser, it takes more than 2 minutes till the counter reflects the changes, that must reflect no difference (one open and one close).
Is there any way to have the information at real time and not have to wait 2/3 minutes till I get the correct information of number of sessions opened ???


No. This is by design to take into account minor loss in comms and then it re-establishes itself. It’s not until 2 minutes later where the Xojo web app finally determines that it’s time to close the session for real - the user isn’t coming back.

Thank you both !!! … for an easy way to determine the number of sessions opened (Derk) and for the confirmation that it takes some time till I could have the right information (Bob)

This tells you how many are currently open. It’s not a running count.

Thanks Greg. The same advice gave me Derk earlier. Question was solved with this advice that suggest an easy way to get the information and with Bob advice that at least 2 minutes will have to wait till the App informs that a session was closed (and he said that this is Xojo design matter)