session namespace

This page documents the uil.session namespace/module. This namespace contains many functions to work with the session API of the dataserver. It contains the functions to start a session and upload your data using this session.

isActive()

Used to check if a session has already started

Returns:

boolean –

start(access_key, callback)

Starts a new participant session on the server

Arguments:
  • access_key (string) – Access key for the experiment

  • callback (sessionCallback) – Callback function that receives information about the session

upload(access_key, data)

Uploads data to the server and finalizes a session

Arguments:
  • access_key (string) – Access key for the experiment

  • data (string) – Data to be sent to the server, in plain text

Returns:

Promise.<Object> – a promise that contains the parsed JSON returned from the server

uploadBinary(access_key, data)

Uploads binary data to the server (leaves the session open)

Arguments:
  • access_key (string) – Access key for the experiment

  • data (Blob) – Data to be sent to the server

Returns:

Promise.<void> – an empty promise

subjectId()

Obtain an subject_id from the the dataserver

Returns:

the subject_id from the data store.