Info
Content

Protocols

MQTT(s)

MQTT (Message Queuing Telemetry Transport) is a simple light-weight protocol for data transfer, supporting a publish / subscribe model. The platform can operate with MQTT up to version 3.1 and with a secured variation called MQTTS using an SSL encryption. We recommend you to use the secured option.

  • Default port for MQTT: 1883
  • Default port for MQTT-secured: 8883

The MQTT credentials can be found in the platform in section Channels, MQTT Credentials.

More information
http://mqtt.org/ (english)
https://www.hivemq.com/mqtt-essentials/ (english)
https://www.root.cz/clanky/protokol-mqtt-komunikacni-standard-pro-iot/ (czech)

HTTP(s)

HTTP (Hypertext Transfer Protocol) is commonly used as a WEB protocol and in modern applications.

The HTTP connection credentials can be found in the platform in section Channels, HTTP Credentials.

More information:
https://cs.wikipedia.org/wiki/Hypertext_Transfer_Protocol (czech)
https://en.wikipedia.org/wiki/Server-sent_events (english)
https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events (english)
https://www.html5rocks.com/en/tutorials/eventsource/basics/ (english)

Communication Principles

Sending messaged to platform (publish)

MQTT:
Host: connect.hexio.cloud
Port: 1883 or 8883 Message (Topic): <your/topic>

HTTP:
URL: https://connect.hexio.io/v1/topic/<your/topic>
Authorization Basic

Example of HTTP reqest, which sends value “22.8” on topic “home/livingroom/temperature” with username nad password “test”:

POST /v1/topic/home/livingroom/temperature HTTP/1.1
Host: connect.hexio.cloud
Authorization: Basic dGVzdDp0ZXN0

22.8

Example of URL address with retain flag set: https://connect.hexio.cloud/v1/topic/garden/temperature?retain=1

Receiving messages from platform (subscribe)

To receive data from the platform on a device, the HTTP GET reqest must be send to the following endpoint. The request is authenticated using Basic authorization. The platform response is a long-lasting EventStream. The stream data are in the JSON format.

URL: https://connect.hexio.cloud/v1/topic/<vas/topic>

Example of HTTP request, which will be returning published messages on topic “v1/topic/garden/temperature”:

GET /v1/topic/garden/temperature HTTP/1.1
Host: connect.hexio.cloud
Authorization: Basic dGVzdDp0ZXN0

Example of HTTP response:

HTTP/1.1 200 OK

Content-type: text/event-stream
data: {"topic":"garden/temperature","retain":false,"payload":"22.8"}
data: {"topic":"garden/temperature","retain":false,"payload":"22.7"}
data: {"topic":"garden/temperature","retain":false,"payload":"22.9"}
No Comments
Back to top