Skip to content

WebSocket API ​

The WebSocket API is the interface that the Biz3 (biz.candyhouse.co) management console uses to talk to the cloud: device management, device operations, members and permissions, access-control credentials (cards / passcodes), developer settings and more.

Note

This document is compiled from the Biz3 source code (src/api, src/websocket). Fields reflect what the client actually sends and reads; the server may return more. The interface changes as Biz3 is updated.

Connection ​

ItemValue
URLwss://82q6nuplv0.execute-api.ap-northeast-1.amazonaws.com/public
ProtocolWebSocket (JSON text messages)

Pass the token as a query parameter when connecting:

text
wss://82q6nuplv0.execute-api.ap-northeast-1.amazonaws.com/public?token=<JWT>&lang=<language>
ParameterDescription
tokenRequired. The signed-in user's Cognito ID Token (JWT), URL-encoded
langUI language such as ja, en, zh-CN, zh-TW; server messages are returned in this language

Authentication ​

Sign in with a CANDY HOUSE account through Amazon Cognito (user pool) and use the ID Token (JWT) as token. The JWT's sub is the account ID (subUUID in Biz). Refresh the token and reconnect when it expires.

Message format ​

Request ​

Every request is a single JSON message. action selects the API category, op selects the operation, and the remaining fields are parameters:

json
{
  "action": "biz3ManageDevice",
  "op": "getDeviceStatus",
  "deviceUUID": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}

Response ​

The server replies with the same action (and op):

json
{
  "action": "biz3ManageDevice",
  "op": "getDeviceStatus",
  "success": true,
  "data": {}
}
FieldDescription
action / opSame as the request; used to match the request
successWhether the request succeeded
dataResponse data; see each API
messageError message on failure, e.g. Limit Exceeded when the device limit is reached
codeError code returned by some APIs (e.g. 406 from the IR remote APIs means no data)
reqContextRequest parameters echoed back by the server (e.g. name, deviceUUID from the request); useful for matching a response to its request

Messages carry no request ID: responses for the same action + op correspond to requests in the order they were sent. The server may also push messages on its own (e.g. device status changes).

Heartbeat and reconnection ​

  • Send a heartbeat {"action": "biz3KeepAlive"} every 5 minutes; the reply contains connectionId. If there is no reply within 3 seconds, treat the connection as dead and reconnect.
  • A connection not established within 5 seconds is considered timed out. After a disconnect, reconnect with a 1–10 second backoff; after repeated failures, first check whether the token has expired.
  • Messages to be sent while disconnected can be queued and sent after reconnecting; do not resend a previous account's messages after switching accounts.

API list ​

Categoryaction
Devices and historybiz3ManageDevice, biz3GetDeviceHistory, biz3GetDeviceBatteryRecord, biz3GetDeviceEmployeeKeys
Device operationsbiz3OperateIoT, biz3TriggerLocker, biz3InvokeWebAPIs, biz3Schedule, biz3IRRemote, biz3Face3Qr
Members and permissionsbiz3GetLoginUser, biz3ManageCompany, biz3ManageEmployee, biz3ManageEmployeeGroup, biz3ManageDeviceGroup, biz3ManageEmployeeDevice, biz3ManageRole, biz3ManageAccessCtlAuthData