SignalR: Near Real-Time Monitoring

Last modified: Jan 31, 2019 @ 06:47

Overview

SignalR is a bi-directional communication protocol and is not proxied by the IoT-A API gateway.

This documentation on SignalR is written from a DDM perspective. When an IoT-A API gateway is used, getRealtimeToken must be changed accordingly.

The SignalR interface is mainly used for near-realtime monitoring of telemetry data. Such interface is very useful for GUI and dashboard applications.

Prerequisite

Reference project with source code: DDMNearRealtime.zip.

Configuration

  1. Edit app_basic.html.
  2. Replace the values of the following settings with the actual values:
    • deviceNetworkId: Enter your Device Network ID.
    • authenticationToken: Enter your API token.
    • host: Enter the URL to your instance API host.

Use

  1. In the browser, open the file app_basic.html.
  2. Add or remove resource(s) to monitor real-time by ID.

Data is received in near real-time when resource (sensor) values change. See the example listings below:

{
    "r": "935c3013-5209-4d08-b846-7994d4cbb81d",
    "UnixTimestamp": 1507209292000,
    "Values": [
        0
    ],
    "SensorId": "935c3013-5209-4d08-b846-7994d4cbb81d",
    "d": "2017-10-05T13:14:52+00:00",
    "bv": false
}
{
    "r": "9cdb1bf1-bb8d-4370-8639-09ac98507a67",
    "UnixTimestamp": 1507800373000,
    "Values": [
        50
    ],
    "SensorId": "9cdb1bf1-bb8d-4370-8639-09ac98507a67",
    "d": "2017-10-12T09:26:13+00:00",
    "v": 50
}

Note: The value is carried with the variable v, bv, or sv if it is numeric, Boolean, or String (or Opaque type), respectively. The use of array here is a non-important legacy heritage.

Advanced

An advanced version of the app is also available in the zip file, in the file app.html. This version provides a graphic display of the watched resources (sensors). The following figure shows an example.

All configuration in this app is done in the browser. The configuration window is accessed by clicking the Edit Configuration button.