Emotiv Cortex JS Client and Mock Service.
Getting Started
nodejs required
$ npm install
$ npm start
To Test from Chrome..
- Install A websocket extension like https://chrome.google.com/webstore/detail/simple-websocket-client/pfdhoblngboilpfeibdedpjgfnlcodoo?hl=en
- Connect to 'ws://localhost:8000`
- To Authorise a client sent `{ "id":1, "method":"authorise", "params": {"license": $myLicenseKey }
- To create a session and subscribe to eeg events
{ "id":1, "method":"createSession", "params": {"_auth":$auth_response_token, "streams":["eeg"] } }
Additional API's defined below..
From QT/QML
Rectangle width: 360 height: 360 WebSocket id: qSocket url: 'wss://localhost:8000' property var cortex: client: 'myApp1' socket:qSocket ComponentonCompleted: cortex cortex cortex cortex
RPC API:
See RPCAPI for more details
Start Session:
<< "id":1 "jsonrpc":"2.0" "method":"createSession" "params": "subscribe":"qua" "_auth": "abc" >> "id":1 "result": "id" : "1234-abcd-abcd-abcd" "status" : "opened" "created" : "2016-12-13T03:13:13.841Z" "headset": "Insight-1234" "streams": "eeg": "cols": "AF3""F7""F3""FC5""T7""P7""O1""O2""P8""T8""FC6""F4""F8""AF4" "spec": "float" "freq": 128 "dev": "cols": "AF3""F7""F3""FC5""T7""P7""O1""O2""P8""T8""FC6""F4""F8""AF4" "spec": "enum" "freq": 2 "cog": "cols": "int" "med" "foc" "fru" "exc" "eng" "lex" freq: 2 "dev": "cols": "battery" "BT Signal" "spec": "enum" "freq": 2 "enums": "none" "poor" "fair" "good" "pow": "cols": "alpha" "betaL" "betaL" "gamma" "delta" "freq": 8 "fac": "cols": "smile" "laugh" "clench" "frown" "suprise" "blink" "smirk_RL" "look_RL" "look_UD" "wink_RL" "freq": 2 "ses": "cols": "status" "mot": "cols": "gyroX" "gyroY" "gyroZ" "freq": 2 "pro": "cols": "action" "status" "score"
Close Session:
<< "id":1 "jsonrpc":"2.0" "method":"updateSession" "params": "status": "closed" "_auth": "abc" >> "id":1 "result":"ok"
Subscribe:
<< "id":1 "jsonrpc":"2.0" "method":"subscribe" "params": "streams":"cog""eeg" "_auth": "abc" }>> "id":1 "result":"ok"
UnSubscribe:
<< "id":1 "jsonrpc":"2.0" "method":"unsubscribe" "params": "streams":"cog""eeg" "_auth": "abc" }>> "id":1 "result":"ok"
Authorize:
<< "id":1 "jsonrpc":"2.0" "method":"authorize" "params": "license:"myLic1" } }>> { "id":1, "result": {"_auth":"AWKU3flNae", "expires":"1234", "scope":["eeg"], "balance":10}}
Messages:
EEG Samples:
"sid" : "ABCD-9999" "time" : 1489217636863 "eeg": 111111111111111
Performance Metrics:
"sid" : "ABCD-9999" "time" : 1489217636863 "cog": 555555555555
Facial Expressions:
"sid" : "ABCD-9999" "time" : 1489217636863 "fac": 1 0341 1 0444 0555 1
Mental Commands:
"sid" : "ABCD-9999" "time" : 1489217636863 "com": "moveR" 098
Profile Training:
"sid" : "ABCD-9999" "time" : 1489217636863 "pro": "moveR""complete"
Contact Quality:
"sid" : "ABCD-9999" "time" : 1489217636863 "qua": 4 1 1 1 0 1
Headset Device:
"sid" : "ABCD-9999" "time" : 1489217636863 "dev": 3 4
JS Client API
Basic Usage:
var cortex = host: 'localhost' port:8000 client:'myApp1' license:'myLic1'cortexcortexcortexcortexcortex
Session Based:
var session = client:'myApp1' license:'myLic'sessionsessionsession session