You are using an unsupported browser. Please update your browser to the latest version on or before July 31, 2020.
close
Home > PIXO Platform Unity SDK > Data Reporting > Functions - JoinSession()
Functions - JoinSession()
print icon

JoinSession()

JoinSession(scenarioID : string, contextExtension : Extension) : Boolean

The JoinSession() function should be called every time the user starts a new session.

It:

  • Joins a user to a session for a given scenario within the module.
  • Auto-generates an xAPI statement and sends it to Apex as a PIXOVR_SESSION_JOINED event.
  • Adds the given context extensions to the xAPI Statement context if it's not null.
  • Returns false if there is no logged in user. Otherwise returns true.
  • Will throw an error if there is already a session in progress that hasn't been ended with a PIXOVR_SESSION_COMPLETE event, typically sent via the CompleteSession() function.

 

OnJoinSessionSuccess is called when the user was able to join the session successfully.

 

OnJoinSessionFailed is called when the user was not able to join the session or when the server is not able to be reached.

Ensure the user has access to the given module.

 

The JoinSession has 2 optional parameters:

  • scenarioID:string - Sets the ApexSystem Scenario ID, which is then used as part of the "id" property of the "object" object. If this is not set, then whatever the ApexSystem Scenario ID was previously set to will be used.
  • contextExtension:Extension - Allows you to include any custom extensions in the context object. This is used to include any additional information you want to report that is not in the standard JoinSession report. See Extensions for more details.

 

Extension currentContextExtension = new Extension();

currentContextExtension.Add("https://www.pixovr.com/xapi/extensions/iri_extension","value");

currentContextExtension.AddSimple("simple_key", "value");

ApexSystem.JoinSession(contextExtension: currentContextExtension);

 

The data report that appears on Apex using the above code:

 

id: e402b5ce-ce8e-4e73-91e0-be53fbc56ada

verb: {

   "id":"https://pixovr.com/xapi/verbs/joined_session",

   "display":{"en":"Joined Session"

   }

}

actor: {

   "mbox":"[email protected]",

   "objectType":"Agent"

}

object: {

   "id":"https://pixovr.com/xapi/objects/34/Generic",

   "objectType":"Activity"

}

context: {

   "platform":"OSXEditor",

   "revision":"1.00.00",

   "extensions":{

       "https://pixovr.com/xapi/extension/device_id":"C79C3829-B4D3-587A-8FB8-5BDACCE16553",

       "https://pixovr.com/xapi/extension/moduleIds":"34",

       "https://pixovr.com/xapi/extension/simple_key":"value",

       "https://pixovr.com/xapi/extension/device_model":"MacBookPro16,1",

       "https://www.pixovr.com/xapi/extensions/iri_extension":"value"

   },"registration":"92886b73-c959-4707-a51b-2efe7d48c99c"

}

version: 1.0.3

timestamp: 2022-06-20T06:55:40

 

Feedback
0 out of 0 found this helpful

scroll to top icon