What is multi-session mode and how should it be used?
When and how should multi-session mode be used?
The Usage Intelligence SDK require a boolean parameter named “multiSessionEnabled” when calling
ruiCreateConfig() or its equivalent. This is used to specify whether multiple user sessions can exist within a single application runtime.
What is the difference between single-session and multi-session mode?
In single-session mode (multiSessionEnabled set to false), when starting the application and calling
ruiStartSDK(), the Usage Intelligence SDK automatically starts a user session, and when calling
ruiStopSDK(), the SDK automatically stops the user session it had started. This means that in single-session mode, a user session is tied to a runtime session, where a user session is considered to start when the application starts and stops when the application stops. This mode is designed for most applications and is convenient because your application does not need to manage sessions and session IDs – they are managed automatically by the Usage Intelligence SDK.
In multi-session mode (multiSessionEnabled set to true), session-management is left up to the developer. This mode is meant to be used when a single application runtime may host multiple user sessions. Examples of this use-case would be applications which require users to log-in, and the application may be left running between different user logins. In such cases, it does not make sense to start a session when the application is executed and stop the session when the application exits, but it would be more appropriate to log a session start when a user logs in and a session stop when the user logs off.
When NOT to use multi-session mode
If your application is used by a single user and a user session should be tied with when the application starts and stops, then single-session mode should be used and therefore the Usage Intelligence SDK will manage starting and stopping sessions. This also applies if you allow multiple parallel executions of your software, where the user can run the software two or more times at the same time. In such cases the multiple sessions in no way affect each other and single-session mode should still be used. Multi-session mode should ONLY be used in cases where you need to manage when a user session starts and stops as described above.
What to consider when using multi-session mode
In multi-session mode, the management of user sessions is left up to the developer. Therefore, the developer must ensure that the functions
ruiStopSession() are called at the appropriate times, for example when a user login and logoff occurs. Also, when calling event tracking functions, you will need to pass the correct session ID under which this event occurred. This must be an ID of a session that has been started and not yet stopped.
What is acceptable as session ID?
The session ID must be a unique value for each session that is started. This may be a random value, or any other unique value generated by your application. Under no circumstance should you start 2 or more sessions with the same session ID.