subscribe
This method is to subscribe to one or more data streams. You can call unsubscribe to cancel a subscription. After you successfully subscribe to a stream, Cortex will keep sending you data sample objects.
See Data Subscription for details.
Parameters
Name | Type | Required | Description |
cortexToken |
| yes | A token returned by authorize. |
session |
| yes | A session id returned by createSession. |
streams |
| yes | The data streams you want to subscribe to. |
The parameter streams must contain one or more values, chosen from this list: "eeg", "mot", "dev", "eq", "pow", "met", "com", "fac", "sys". See Data Subscription for details.
To subscribe to the "eeg" stream, you must have a paid license and activate the session.
Result
The result is an object that includes these fields:
Name | Type | Description |
success |
| For each stream you successfully subscribed to, this array contains an object that describe the data structure of this stream. |
failure |
| For each stream you failed to subscribed to, this array contains an object that describes the error. |
In case of success, you get an object with these fields:
Name | Type | Description |
streamName |
| The name of the stream. |
cols |
| The labels of the columns that are part of this stream. |
sid |
| The session id. |
Please note that the field cols is especially important. This field tells you which values you will get in the data stream, and in which order. See Data sample object for details.
In case of failure, you get an object with these fields:
Name | Type | Description |
streamName |
| The name of the stream. |
code |
| The error code. |
message |
| The error message. |
Examples
Subscribe successfully to motion and performance metrics.
Subscribe successfully to performance metrics, but fail to subscribe to raw EEG.
Last updated