Notify API

Enables notification of various events when a change occurs for Guest Sessions or transmitter.

CoAP Options

OptionDescriptionValueRequired
URI-PathResource segment #1v1Yes
URI-PathResource segment #2notifyYes
ObserveEnables observation for events.0 (register)Yes
URI-QueryAction query parameter. Performs an action before attempting to observe.action=<get_sessions>No

OBSERVE /v1/notify

If optional query parameter ?action=get_sessions is defined, it will pull active sessions first before listening for notifications.

The following notifications will be sent if there is a change:

  • Settings
  • Sessions
  • Ping (Will be send every 30 seconds. Client is expected to ACK it to determine if it is still alive).

Settings Notification

Notification for settings will be the same as calling GET /v1/settings.

{
   "responseTypes":[
      "settings"
   ],
   "globalSessionSequence":120,
   "timestamp":"2018-03-15T15:38:57",
   "deviceName":"T7470",
   "firmwareVersion":"8.4.100.43",
   "settings":{
      "datetime":"2018-03-15T15:38:57",
      "systemId":0,
      "defaultTargetGoal":300,
      "statisticsClearMark":24
   }
}

Sessions Notification

Notification of a session change will be the same as calling GET /v1/sessions?number= along with the changed statistics.

{
   "responseTypes":[
      "sessions",
      "statistics"
   ],
   "globalSessionSequence":121,
   "statistics":{
      "guestsServed":41,
      "percentLate":0,
      "percentOnTime":100,
      "averageTimeServed":280,
      "numSessions":42
   },
   "sessions":[
      {
         "id":49,
         "sessionSequence":121,
         "uuid":"3d8b1201-1ba9-454b-94a1-912df95f2d0b",
         "number":83,
         "partySize":1,
         "goalInSeconds":300,
         "created":"2018-03-15T15:42:37",
         "started":"2018-03-15T15:42:37",
         "label":null,
         "state":"started"
      }
   ]
}

Ping Notification

Every 30 seconds, a ping notification will be sent and is expected to be ACK by the client. Failure to acknowledge ping response three times in a row will result in the client being booted out of the transmitter.

{
   "responseTypes":[
      "ping"
   ],
   "globalSessionSequence":120,
   "activeSessionCount":0,
   "timestamp":"2018-03-15T15:41:47",
   "deviceName":"T7470",
   "firmwareVersion":"8.4.100.43"
}

Example Code Request

// Using node-coap (yarn add coap, npm install coap): https://github.com/mcollina/node-coap
const coap = require('coap');

let req = coap.request({
  host: '10.0.1.32',
  port: 5683,
  pathname: '/v1/notify',
  method: 'GET'
});

req.on('response', res => {
  res.on('data', data => {
    let payload = data.toString('utf-8'),
         json = JSON.parse(payload);
    console.log(json);
    
    // Here you may filter out the responseTypes for what interests you
    // such as if you only want to synchronize sessions. There are other
    // events such as setting changes.
  });
});

// Send request
req.end();