Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| documentation:api-http-websockets [2014-01-14 21:30] – created 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 ===== | ||
| + | |||
| + | The WebSocket command interface is based on a tag system. | ||
| + | |||
| + | The format of a command is: | ||
| + | < | ||
| + | $tag COMMAND [optional=parameters, | ||
| + | </ | ||
| + | |||
| + | ===== URI's and Commands ===== | ||
| Once a connection is upgraded to a websocket, the following text based commands are available. | Once a connection is upgraded to a websocket, the following text based commands are available. | ||
| Line 9: | Line 39: | ||
| ==== Command: subscribe ==== | ==== Command: subscribe ==== | ||
| - | Syntax: | + | The subscribe |
| - | + | ||
| - | Syntax: subscribe <tag> class=< | + | |
| - | Syntax: subscribe | + | Command format: |
| + | <code> | ||
| + | $tag SUBSCRIBE < | ||
| + | </code> | ||
| + | The value for tag: | ||
| + | * The value for tag designates the tag of returned data in the above datatype. | ||
| + | Possible values for type: | ||
| + | * pool | ||
| + | * Refers to a $interfaceGroupID: | ||
| + | * class | ||
| + | * Refers to statistics regarding a class. The following is available in the $item field... | ||
| + | * Class: | ||
| + | * basic | ||
| + | * Refers to a basic counter. The following basic counters are available in the $item field... | ||
| + | * Counter: | ||
| + | * Counter: | ||
| + | * Counter: | ||
| + | * Counter: | ||
| ==== Command: unsubscribe ==== | ==== Command: unsubscribe ==== | ||
| - | Syntax: unsubscribe <tag> | + | WIP |
| + | Command format: | ||
| + | < | ||
| + | $tag UNSUBSCRIBE | ||
| + | </ | ||