Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
documentation:api-http-websockets [2014-01-14 21:30] – created nkukarddocumentation: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:
 +<code>
 +{
 +  status: 'success',
 +  data: $data
 +}
 +</code>
 +
 +Errors:
 +<code>
 +{
 +  status: 'error',
 +  message: 'error string'
 +}
 +</code>
 +===== Command Interface =====
 +
 +The WebSocket command interface is based on a tag system.
 +
 +The format of a command is:
 +<code>
 +$tag COMMAND [optional=parameters, ...]
 +</code>
 +
 +===== 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: subscribe <tag> pool=<InterfaceGroupID:PoolName> +The subscribe command subscribes a WebSocket to receive periodic statistical updates. The $tag value will be used while streaming statistics (see [[api-data-types#typeotsjsonstats|OTSJsonStats]]).
- +
-Syntax: subscribe <tag> class=<InterfaceGroupID:ClassID>+
  
-Syntaxsubscribe <tag> basic=<BasicStatName>+Command format: 
 +<code> 
 +$tag SUBSCRIBE <$type=$item[$type2=$item2] [$typeX=$itemX] 
 +</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:$poolName pair, this is specified as the $item field
 +  * class
 +    * Refers to statistics regarding a class. The following is available in the $item field...
 +      * Class:$interfaceGroupID:$classID
 +  * basic
 +    * Refers to a basic counter. The following basic counters are available in the $item field...
 +      * Counter:ConfigManager:TotalPools
 +      * Counter:ConfigManager:TotalPoolMembers
 +      * Counter:ConfigManager:ClassPools:$interfaceGroupID,$classID
 +      * Counter:ConfigManager:TotalClassPools:$classID
 ==== Command: unsubscribe ==== ==== Command: unsubscribe ====
  
-Syntax: unsubscribe <tag>+WIP
  
 +Command format:
 +<code>
 +$tag UNSUBSCRIBE
 +</code>