Skip to content

Streams

Will Witman edited this page Mar 9, 2016 · 2 revisions

Monitor Log Streams

Zetta provides an easy way to stream data from streams to clients using web sockets. Below are some considerations for what this data would look like coming out of the system.

For example, using a single, dedicated WebSocket, this subscribes only to the state stream for this particular device:

{
  title: "state",
  rel: 
  ["monitor","http://rels.zettajs.io/object-stream"],
  href: "ws://zetta-cloud-2.herokuapp.com/servers/Detroit/events?topic=display%2F0d919602-8755-4727-9832-970efc17c63d%2Fstate"
},

Some general notes on the Stream Responses.

  1. topic is what is used to subscribe to the stream in general. For single stream readings it will be <device type>/<device-uuid>/<stream name>
  2. For globally subscribing to topics the format will be <device type>/<device id>/<stream name>
  • All devices with that particular type and stream name will be subscribed to
  • The id property will contain the device id of the particular device returned.
Example Microphone Amplitude Stream
{
  "data":30,
  "topic":"sound/7A8B1779-FEEE-493C-8ADC-32460A6BD8A1/amplitude",
  "timestamp":1402676545565
}

Example Device Log Streams

Example log message after a lcd screen's text is updated through a transition.

{
  "topic":"lcd/8142E11C-87AE-4C13-9DD1-E2900EB97BF0/logs",
  "timestamp":1402676545565,
  "transition":"change",
  "input":[
    {
      "name":"message",
      "value":"I heard dat!"
    }
  ],
  "properties": {
    "id": "8142E11C-87AE-4C13-9DD1-E2900EB97BF0",
    "type":"lcd",
    "name":"My LCD",
    "state":"ready",
    "message": "I heard dat!"
  }
}
Clone this wiki locally