-
Notifications
You must be signed in to change notification settings - Fork 114
Streams
Will Witman edited this page Mar 9, 2016
·
2 revisions
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.
-
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>
- 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.
{
"data":30,
"topic":"sound/7A8B1779-FEEE-493C-8ADC-32460A6BD8A1/amplitude",
"timestamp":1402676545565
}
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!"
}
}
Need help? Visit the Zetta Discuss List !
Need help? Visit the Zetta Discuss List ! |
---|
About Zetta
Videos and webcasts
- NEW! Building with Zetta
Tutorials
- NEW! Zetta tutorial series
- Quick start
- Configure a simple device
- Build a mock LED device
- Use the browser client
- Deploy a Zetta server to Heroku
Understanding Zetta
Writing Zetta drivers
- Finding Zetta device drivers
- Create a device driver from starter code
- More coming soon...
Using streams
Reference