Writing through MQTT endpoint

Connio supports both tcp and websocket connections to its MQTT broker. The following addresses must be used when connecting to the Connio platform over MQTT:

ProtocolAddress
Tcptcp://mqtt.connio.cloud:1883
Secure Tcptcp://mqtt.connio.cloud:8883
Websocketws://mqtt.connio.cloud:8000

🚧

IMPORTANT

Only MQTT version 3.1.1 is supported.

Make sure that your keep-alive is 25 seconds, and timeout is 60 seconds.

Important MQTT Topics

TopicDescription
connio/data/out/devices/{id}/properties/{name}publish data to the platform in raw format (e.g. 45 as temperature value). String values should be between quotes (e.g. "Operational"), and object types can be provided as standard JSON objects (e.g. {"config": { "volume": 34 } }).
connio/data/out/devices/{id}/jsonpublish data to the platform in JSON. Ideal for batch writes.

❗️

Property Names in Topics

Property names must be always given in lowercase within the topic paths.

Writing over MQTT

MQTT provides a stateful and bi-directional connection to devices. The same connection can be used both for writing and receiving data to/from the platform.

In order to write data to the platform a device should do the following:

  1. It should connect to one of the MQTT endpoints using its device id as the client id, device key id as the username and device key secret as the password.
  1. Once connected, it can publish data in two ways:

2.1. Device can publish single data point to connio/data/out/devices/{id}/properties/{name} - no timestamp is needed, just the raw data (e.g. 34, or "alert_state", or { "version": "1.2" }. Timestamp is set automatically by the server at the time of the receive.

2.2. Alternatively, multiple data points can be published to connio/data/out/devices/{id}/json topic in Data Feed format for more control.

For example: connio/data/out/devices/_dev_571692235317590466/json

{
  "dps": [
    { "t": "2017-05-01T14:00:57.467Z", "v": 15.45, "prop": "temperature" },
    { "t": "2017-05-01T14:00:57.468Z", "v": 45, "prop": "humidity"},
    ...
  ]
}