Overview
The SendSimpleSessionEvent() function is how you send any simplified data to the PIXO Platform during a session. It:
- Constructs an xAPI statement from provided session data
- Sends an event with xAPI statement data
- Returns FALSE if:
- There is no logged in user
- JoinSession has not been called to start a session
- action is null or an empty string
SendSessionEvent() vs. SendSimpleSessionEvent()
- SendSessionEvent() — used during a session to signal events or report module specific data. This requires nearly a fully described xAPI Statement to be passed in. See this page for more information.
-
SendSimpleSessionEvent() — used during a session to signal events or report module specific data. This is a simplified version of SendSessionEvent().
Parameters
The SendSimpleSessionEvent() Function has 2 required parameters and 1 optional parameter:
- action:string — The name of the event that has occurred within the module. The action is the name of the Verb.
- targetObject:string — The name of the object or person that the action is taking place against or on. The targetObject is the name of the Activity and used in the activity ID.
- contextExtension:Extension — Use this parameter to add data to the Context in the xAPI structure.
SendSimpleSessionEvent returns FALSE
if there action
is null or an empty string. In all other cases, TRUE
will be returned.
Handling Response
- OnSendEventSuccess() — called when the platform indicates that the session event was sent successfully.
- OnSendEventFailed() — called when the platform indicates that the session event was not received successfully, had invalid data or the server was not reachable.
In the Example Code section below, you'll see C# examples on how to bind to the event delegates.
Example Code
Calling SendSimpleSessionEvent
ApexSystem.SendSimpleSessionEvent("Demo Session Event", "User", null);
Binding to Session Event Success/Failed Events
void Start()
{
ApexSystem.Instance.OnJoinSessionSuccess.AddListener(OnSessionJoinedSuccess);
ApexSystem.Instance.OnJoinSessionFailed.AddListener(OnSessionJoinedFailed);
ApexSystem.Instance.OnCompleteSessionSuccess.AddListener(OnSessionCompletedSuccess);
ApexSystem.Instance.OnCompleteSessionFailed.AddListener(OnSessionCompletedFailed);
ApexSystem.Instance.OnSendEventSuccess.AddListener(OnSendSessionEventSuccess);
ApexSystem.Instance.OnSendEventFailed.AddListener(OnSendSessionEventFailed);
}
void OnSessionJoinedSuccess(HttpResponseMessage joinResponse)
{
Debug.Log("Session joined successfully.");
}
void OnSessionJoinedFailed(FailureResponse failedLoginResponse)
{
Debug.Log("Session was not joined.");
}
void OnSessionCompletedSuccess(HttpResponseMessage joinResponse)
{
Debug.Log("Session completed successfully.");
}
void OnSessionCompletedFailed(FailureResponse failedLoginResponse)
{
Debug.Log("Session was not completed.");
}
void OnSendSessionEventSuccess(HttpResponseMessage joinResponse)
{
Debug.Log("Session event sent successfully.");
}
void OnSendSessionEventFailed(FailureResponse failedLoginResponse)
{
Debug.Log("Session event failed to send.");
}