Command exposes an authenticated SignalR hub at:
https://api.command.on-sight.co.nz/sensordata
Connect using a SignalR client and a valid Command access token. Register your event handlers before requesting subscriptions.
Get an API token
Sign in to Command and open My profile, then scroll to API tokens. You can also reach My profile from your profile avatar. Enter a token name, choose a 90, 180 or 365-day lifetime, and select Generate token. Copy and securely save it. The secret is shown once. See Create and manage API tokens for complete instructions.
For the JavaScript SignalR client, return the token itself from accessTokenFactory; do not include the Bearer prefix in the returned value:
const connection = new signalR.HubConnectionBuilder()
.withUrl('https://api.command.on-sight.co.nz/sensordata', {
accessTokenFactory: () => apiToken
})
.withAutomaticReconnect()
.build();
Here, apiToken is your securely supplied Command API token, not a literal value to commit to source control. The SignalR client supplies authentication for the transport. Tokens retain the owner's current access; subscription permissions still apply.
Generate and configure a replacement before expiry. Expired or revoked tokens fail authentication on new connections and reconnections. An existing live-feed connection is not forcibly disconnected on expiry or revocation; stop it and reconnect with the replacement token when rotating credentials. After reconnecting, restore subscriptions and reconcile missed readings as described below.
Subscriptions and events
| Hub method | Purpose | Event |
|---|---|---|
RequestAssetFeed(assetId) |
Subscribe to one asset's readings. | HardwareSensorUpdate |
RequestAssetsFeed(assetIds) |
Subscribe to multiple assets. | HardwareSensorUpdate |
RequestCompanyAlerts(companyId) |
Subscribe to company breach alerts. | AlertBreach |
RequestZoneFeed(zoneId) |
Subscribe to updates for a zone. | AssetZoneUpdate |
DetachAssetFeed(assetId) |
Stop an asset subscription. | — |
Subscriptions are subject to access checks. Receiving no events does not itself establish that a subscription was authorised or that a device is offline.
Handling the stream
Process sensor readings, breaches and zone changes as separate event types. Use the event payload reference for their fields, timestamps and units.
The current Command hub configuration uses numeric enums in JSON events. HTTP API responses use string enum names. Do not assume both transports use identical enum representations.
Reconnecting
The live feed provides updates while connected. Its inspected subscription contract has no replay cursor or resume-from-timestamp operation.
After reconnecting, restore subscriptions and reconcile history for the relevant assets. Keep latest-state displays separate from historical reconciliation; a history aggregate is not a replay of an individual live event.
API reference
Browse Command's HTTP endpoints in the public Swagger UI, or use the public OpenAPI JSON. Reading public documentation does not require authentication; protected API calls still do.
The public document excludes SuperAdmin-only operations. The full Admin API v1 document requires a valid Command SuperAdmin bearer token. In the UI, use Authorize before selecting it.
SignalR hub methods and event payloads are documented in this knowledgebase separately from the HTTP OpenAPI reference.
Review before publication
Verify authentication, subscriptions and JSON encoding against the deployed hub. These contracts were reviewed from source; the examples have not been validated against a production connection.