Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
documentation:api-http-websockets [2014-01-15 12:55] – [Command: subscribe] nkukard | documentation:api-http-websockets [2014-01-16 15:36] (current) – [Command: subscribe] nkukard | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== HTTP WebSockets Interface ====== | ====== HTTP WebSockets Interface ====== | ||
+ | ===== JSON Encapsulation ===== | ||
+ | |||
+ | All JSON responses are encapsulated within a status structure. | ||
+ | |||
+ | Success: | ||
+ | < | ||
+ | { | ||
+ | status: ' | ||
+ | data: $data | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | Errors: | ||
+ | < | ||
+ | { | ||
+ | status: ' | ||
+ | message: 'error string' | ||
+ | } | ||
+ | </ | ||
===== Command Interface ===== | ===== Command Interface ===== | ||
Line 20: | Line 39: | ||
==== Command: subscribe ==== | ==== Command: subscribe ==== | ||
- | The subscribe command subscribes a WebSocket to receive periodic statistical updates. The $tag value will be used while streaming statistics (see [[api-data-types# | + | The subscribe command subscribes a WebSocket to receive periodic statistical updates. The $tag value will be used while streaming statistics (see [[api-data-types# |
Command format: | Command format: | ||
< | < | ||
- | $tag SUBSCRIBE < | + | $tag SUBSCRIBE <$type=$item> |
</ | </ | ||
+ | |||
+ | The value for tag: | ||
+ | * The value for tag designates the tag of returned data in the above datatype. | ||
Possible values for type: | Possible values for type: | ||
Line 32: | Line 54: | ||
* class | * class | ||
* Refers to statistics regarding a class. The following is available in the $item field... | * Refers to statistics regarding a class. The following is available in the $item field... | ||
- | * Class: | + | * Class: |
* basic | * basic | ||
* Refers to a basic counter. The following basic counters are available in the $item field... | * Refers to a basic counter. The following basic counters are available in the $item field... | ||
Line 41: | Line 63: | ||
==== Command: unsubscribe ==== | ==== Command: unsubscribe ==== | ||
- | Syntax: unsubscribe <tag> | + | WIP |
+ | Command format: | ||
+ | < | ||
+ | $tag UNSUBSCRIBE | ||
+ | </ | ||