WebSockets (Preview)

Consume live metrics via WebSocket.

Connecting

Create a new WebSocket connection. Provide a Floor ID and receive metrics for spaces on that floor. See details here

Stream Data

After connecting to your WebSocket, receive updates when a space's presence status changes.

The update_type denotes whether an update is a live update or a full space list refresh update. The WebSocket will send a refresh once a minute. counting_mode denotes the sensor type that triggered the update. Either oa or entry * We only support OA at this time

WebSocket events are in the following JSON format:

Example refresh response

Copy
Copied
{
    "update_type": "refresh",
    "data": {
        "spc_12345": {
            "timestamp": "2023-12-01T03:09:38Z",
            "presence": false,
            "counting_mode": "oa"
        },
        "spc_1678910": {
            "timestamp": "2023-12-01T13:18:20Z",
            "presence": true,
            "counting_mode": "oa"
        }
    }
}

Example live response

Copy
Copied
{
    "update_type": "live",
    "data": {
        "spc_12345": {
            "timestamp": "2023-12-01T03:09:38Z",
            "presence": true,
            "counting_mode": "oa"
        }
    }
}