Skip to content

User Hub

Endpoint: https://api.openshock.app/1/hubs/user

The user hub is the primary channel for authenticated users to control devices and receive real-time events.

Connect using any SignalR client library, the transport is WebSocket-only with JSON payloads.

Connecting

Provide the authentication headers described in the overview, then connect to the endpoint using your SignalR client's WebSocket transport.

Server Methods

Methods your client can invoke on the hub.

ControlV2

Send one or more control commands to shockers, allows specifying a custom sender name that appears in control logs.

ParameterTypeDescription
shocksarray of ControlOne or more shocker commands.
customNamestring or nullCustom name to display as the sender in logs.

CaptivePortal

Enable or disable the captive portal on a device. Requires device ownership.

ParameterTypeDescription
deviceIdUUIDThe device identifier.
enabledbooleantrue to enable, false to disable.

EmergencyStop

Immediately stop all activity on a device. Requires device ownership.

ParameterTypeDescription
deviceIdUUIDThe device identifier.

OtaInstall

Trigger a firmware update on a device. Requires device ownership.

ParameterTypeDescription
deviceIdUUIDThe device identifier.
versionstringSemantic version to install (e.g. 1.2.0).

Reboot

Reboot a device. Requires device ownership.

ParameterTypeDescription
deviceIdUUIDThe device identifier.

Client Events

Events the server sends to your client. Register handlers for these using your SignalR client's event subscription mechanism.

Welcome

Sent immediately after connecting.

FieldTypeDescription
connectionIdstringYour SignalR connection ID.

DeviceStatus

Provides the current online state and firmware version for all devices accessible to the user. Sent on connect and whenever a device's status changes.

FieldTypeDescription
deviceOnlineStatesarray of DeviceOnlineStateStatus of each device.

Log

Emitted when a control command is executed on a device.

FieldTypeDescription
senderControlLogSenderWho triggered the command.
logsarray of ControlLogLog entries for each shocker affected.

DeviceUpdate

Notifies when a device or its shockers are modified or removed.

FieldTypeDescription
deviceIdUUIDThe device identifier.
typeDeviceUpdateTypeWhat changed.

OtaInstallStarted

A firmware update has begun.

FieldTypeDescription
deviceIdUUIDThe device identifier.
updateIdintegerUnique update identifier.
versionstringVersion being installed.

OtaInstallProgress

Progress update for an ongoing firmware install.

FieldTypeDescription
deviceIdUUIDThe device identifier.
updateIdintegerUnique update identifier.
taskOtaUpdateProgressTaskCurrent stage of the update.
progressfloatProgress within the current task (0.0 -- 1.0).

OtaInstallFailed

Firmware install failed.

FieldTypeDescription
deviceIdUUIDThe device identifier.
updateIdintegerUnique update identifier.
fatalbooleanWhether the failure triggered a rollback.
messagestringError description.

OtaRollback

Firmware rolled back to the previous version after a failed update.

FieldTypeDescription
deviceIdUUIDThe device identifier.
updateIdintegerUnique update identifier.

OtaInstallSucceeded

Firmware update completed successfully.

FieldTypeDescription
deviceIdUUIDThe device identifier.
updateIdintegerUnique update identifier.