Realtime Data over WebSocket

After creating a Service User within the Chronicall UI, you will be given an authentication key.
Anytime a request is made to the API, an authentication key must be present.

By having the authorization key present, you will be able to access everything that the Service User is set up in Chronicall to have access to.

Note: For this feature, you must be updated to version 4.0.9 or newer.

Use Cases

ws://{ChronicallServerPath}/rest/api/v1/realtime-metric-subscription?id={MetricId}&auth_token={AuthenticationKey}

Arguments

ChronicallServerPath

The IP address and Port of the Chronicall Server.



MetricId



The Metric ID of the desired metric to begin receiving updates for. A single websocket can subscribe to receive updates for multiple metrics. Pattern: ...?id={MetricId_1}&id={MetricId_2}...



AuthenticationKey




A Service User's authentication key.

Response

If a successful request is made, then the websocket will connect and will start receiving value update messages. There are several different types of value update messages that can be received. See examples of each type under the "Metric Values" section.

{
  "key": {
    "metricId": "K0FLAEB6",
    "categoryValue": "John Doe(481)"
  },
  "value": {
    "lastUpdateTime": "2019-10-01T10:17:56.496-06:00",
    "count": 15,
    "type": "COUNT"
  }
}

Potential Errors

Status CodeFailure

400 Bad Request

Malformed or missing query parameters.



401 Unauthorized



The authentication key wasn't valid.



403 Forbidden




One or more of the requested metrics doesn't exist or are not assigned to the authenticated user.