---
updatedAt: 2025-06-09T22:28:23.000Z
agentTools:
  projectIndex: https://docs.connio.com/llms.txt
---

# 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:

| Protocol   | Address                       |
| :--------- | :---------------------------- |
| Tcp        | tcp\://mqtt.connio.cloud:1883 |
| Secure Tcp | tcp\://mqtt.connio.cloud:8883 |
| Websocket  | ws\://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

| Topic                                                 | Description                                                                                                                                                                                                                                   |
| :---------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 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}`/json               | publish 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.

![1394](https://files.readme.io/8fb605a-Screen_Shot_2017-07-03_at_7.56.06_PM.png "Screen Shot 2017-07-03 at 7.56.06 PM.png")

2. 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](https://docs.connio.com/docs/data-feed) format for more control.

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

```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"},
    ...
  ]
}
```