WebApplication.SessionCount

From Xojo Documentation

Read-Only Property (As Integer )
IntegerValue = aWebApplication.SessionCount

New in 2011r1

Supported for all project types and targets.

Returns the number of active sessions.

Notes

Each session corresponds to a user that is connected to the web app. Each session uses 2 or more sockets. Typically 4 sockets are used when setting up the initial session and then 2 sockets are used thereafter.

By default a web app allows for a maximum of 200 sockets. This means a maximum of 50 to 100 users can be connected to a web app at one time, presuming the app is not doing significant processing and you have enough RAM on the server. If you want to enable additional concurrent users you can increase the maximum sockets using the command-line options described on the WebApplication page like this:

MyApp --MaxSockets=300

If you are using SSL, you'll need to set the maximum secure sockets with a command like this:

MyApp --MaxSecureSockets=300

Sample Code

This code in a Button on a page will display a Message Box on the current page for all connected Sessions:

For i As Integer = 0 To App.SessionCount - 1
App.SessionAtIndex(i).MsgBox("App shutdown.")
Next

See Also

WebApplication.SessionAtIndex, WebApplication.SessionForControl, WebApplication.SessionForControlID, WebApplication.SessionWithIdentifier