WebSocket
Beta — Next Phase
WebSocket support is in active development and is not yet available for integration use. The documentation below reflects planned API behavior. APIs and message formats may change before the stable release.
WebSocket is used for real-time device status queries, executing device operations, and receiving device events.
REST API is suited for standard request-response integrations. WebSocket is suited for integrations that maintain a persistent connection and need low-latency interaction and real-time events.
Use Cases
- Listen for device online, offline, or state change events
- Listen for IO state changes such as relays, digital inputs, and sensors
- Query device status over a long-lived connection
- Execute device operations over a long-lived connection
- Reduce the need to poll the REST API frequently
Out of Scope
- Access tokens are not obtained through WebSocket
- Historical events cannot be replayed through WebSocket
- Bulk device control is not supported through WebSocket
Basic Flow
- Call Create Access Token to obtain an
accessToken. - Call
POST /wlte/v1/ws/ticketto exchange the access token for a one-timewsTicket. - Establish a WebSocket connection using
wss://.../ws?ticket={wsTicket}. - After the connection succeeds, an authenticated session is established.
- Use
requestmessages to sendsession.ping,device.status.get, ordevice.operation.execute. - Match request results by
requestIdinreplymessages. - Handle device events by
topicineventmessages. - Reconnect according to the reconnection rules after the connection closes.
Start Here
- Create WebSocket Ticket — Get a one-time connection credential
- Establish Connection — Authenticate and start a session
- Message Format — Understand the request / reply / event structure
