Starting a Session

The RUISDK.StartSession function starts an explicit session for event tracking in the SDK. It must be paired with a call to RUISDK.StopSession.

Explicit sessions are allowed only if RUISDK.CreateConfig was called with multiSessionEnabled = true. When explicit sessions are enabled, a valid sessionID becomes a required parameter to the event tracking APIs, as described in Parameters.

RUISDK.StartSession can be called between RUISDK.StartSDK and RUISDK.StopSDK, and can be called zero or more times.

RUISDK.StartSession is a synchronous function, returning when all functionality is completed.

RUISDK.StartSession

RUIResult RUISDK.StartSession (String sessionID)

Parameters

The RUISDK.StartSession function has the following parameters.

RUISDK.StartSession Parameters

Parameter

Description

sessionID (String)

This parameter should contain a unique ID that refers to the user session that is being started. This same ID should later be used for event tracking.

The content of a sessionID is conditioned and validated (after conditioning) with the following rules:

Conditioning—All leading white space is removed.
Conditioning—All trailing white space is removed.
Conditioning—All internal white spaces other than space characters (' ') are removed.
Validation—Cannot be shorter than 10 UTF-8 characters.
Validation—Cannot be longer than 64 UTF-8 characters.

The resulting conditioned and validated sessionID must be unique (i.e. not already in use).

Note:With the above conditioning, two sessionIDs that differ only by white space or after the 64th character, will not be unique. A sessionID should not be re-used for different sessions.

Returns

The RUISDK.StartSession function returns a RUIResult enum value with the following possible values.

RUISDK.StartSession Returns

Return

Description

ok

Function successful.

sdkInternalErrorFatal

Irrecoverable internal fatal error. No further API calls should be made.

sdkAborted

A required New Registration has failed, and hence the SDK is aborted. RUISDK.StopSDK and RUISDK destructor are possible.

suspended

Instance has been instructed by Server to back-off. Will return to Running once back-off cleared.

permanentlyDisabled

Instance has been instructed by Server to disable. This is permanent, irrecoverable state.

sdkOptedOut

Instance has been instructed by the application to opt-out.

configNotCreated

Configuration has not been successfully created.

sdkNotStarted

SDK has not been successfully started.

functionNotAvail

Function is not available.

sdkAlreadyStopped

SDK has already been successfully stopped.

invalidSessionIDExpectedNonEmpty

The sessionID is expected to be non-empty, and it was not.

invalidSessionIDTooShort

The sessionID violates its allowable minimum length.

invalidSessionIDTooLong

The sessionID violates its allowable maximum length.

invalidSessionIDAlreadyActive

The sessionID is already currently in use.