Repository navigation
Websocket
Hundemeier edited this page Jun 21, 2018
·
1 revision
For the communication of KeyEvents is a websocket available. The endpoint is /websocket.
The data that is send through the socket is always JSON data with the following structure:
{
"Type": Int,
"Data": <depends>,
"Error": String,
"Time": String, //RFC3339 encoded time of the event
}The available Types for the Type field are:
0: UNKNOWN
1: KEY_EVENT
2: CONFIG_WROTE
3: CONFIG_DELETE
The Type of the Data field changes with the Type of the event. The UNKNOWN event has no data. The Error filed may have no data or has a value of "".
-
KEY_EVENT: The data is of the following structure:
...
"Data": {
"KeyboardID": Int, //the ID of the keyboard from which the event originated
"KeyCode": Int, //the keycode of the key that triggered the event
"Value": Int //what happended in the event
}
...Value can be one of the following:
0: KEY_UP //key was unpressed
1: KEY_DOWN //key was pressed
2: KEY_HOLD_DOWN //is send out every second if the key is hold down
-
CONFIG_WROTEandCONFIG_DELETE: TheDatafield is of type Boolean. If the action was successful, the value istrueotherwisefalseand theErrorfield may contain more information.
Get back to home