Unsubscribe from real-time data
Stops delivering realtime_data messages to this connection. The connection stays open and other commands keep working.
Device data is not lost: other subscribed connections of the application receive it, and if there are none, the server accumulates the data in the application queue until the next subscription (consume_req).
Request and response: unconsume_req → unconsume_resp.
Access: a token of any access level.
Current ONS version
The server accepts the unbind field from the v0.17 description, but in the current version it has no effect. The response contains the operation_id from the request and consumer_count.
Request
Fields not marked as required may be omitted.
| Field | Type | Description |
|---|---|---|
cmd | string | unconsume_req |
operation_id | string | Any string; the server returns it in the response to match the request and the response |
unbind | bool | Has no effect on the server. Default false |
{
"cmd": "unconsume_req",
"operation_id": "unsub1"
}
Response
| Field | Type | Description |
|---|---|---|
cmd | string | unconsume_resp |
operation_id | string | Value from the request |
status | uint8 | 1 — the connection is unsubscribed, 2 — error |
consumer_count | uint16 | How many connections of the application remain subscribed. Only when status = 1 |
error_code, error_text | uint8, string | Only on error, see below |
{
"cmd": "unconsume_resp",
"operation_id": "unsub1",
"status": 1,
"consumer_count": 0
}
Errors
error_code | error_text | What happened |
|---|---|---|
| 1 | Not consuming current APP | The connection is not subscribed to data |
Good to know
- Downlink statuses keep coming. If the connection subscribed with
"downlink_status": true,downlink_statusmessages still arrive after unsubscribing. The status subscription is not removed when the connection closes either — see thedownlink_statusmessage. - To enable
downlink_statusfor an already subscribed connection, unsubscribe and subscribe again with"downlink_status": true: the flag is applied only when the subscription is made. - No need to unsubscribe before closing the connection: the server removes the subscription itself.
See also
consume_req— subscribe to data.connections_list— which connections of the application are subscribed.