ezeio2:apiref:subscribe

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revisionBoth sides next revision
ezeio2:apiref:subscribe [2021-01-27 22:23] andrehezeio2:apiref:subscribe [2021-01-28 20:53] andreh
Line 110: Line 110:
  
 The STATUS updates will be sent every 10 minutes even if a faster subscription is active. The STATUS updates will be sent every 10 minutes even if a faster subscription is active.
 +
 +This is an example of what a ''STATUS'' update looks like (whitespace added for readability):
 +<code javascript>
 +{
 +  "channel": "export:123",
 +  "data": {
 +    "type": "STATUS",
 +    "serial": "ABC-123",
 +    "time": "2021-01-31T14:20:00Z",
 +    "fields": [
 +      {
 +        "1": 73.4
 +      },
 +      {
 +        "2": 8.112
 +      }
 +    ]
 +  }
 +}
 +</code>
 +Note that the fields array will include all configured fields for this unit - regardless of their log setting. All fields are always logged every 10 minutes.
 +
 +A ''LOGDATA'' update has the following format (whitespace added for readability):
 +<code javascript>
 +{
 +  "channel": "export:123",
 +  "data": {
 +    "type": "LOGDATA",
 +    "serial": "ABC-123",
 +    "time": "2021-01-31T14:21:15Z",
 +    "timeout": 0,
 +    "fields": [
 +      {
 +        "2": 9.021
 +      }
 +    ]
 +  }
 +}
 +</code>
 +Note that this message only includes the fields that are configured for fast logging (interval less than 10 minutes). Please see below for the meaning of the ''timeout'' property.
  
 **Step 3 : Request subscription changes** **Step 3 : Request subscription changes**
Line 126: Line 166:
 Up to 50 devices can be included in the same command Up to 50 devices can be included in the same command
  
-=== Example code (PHP) ===+=== Example code to set up the websocket channel and receive data (PHP) ===
 <code php> <code php>
 <?php <?php
  • ezeio2/apiref/subscribe.txt
  • Last modified: 2021-01-28 23:49
  • by andreh