MQTT Interface
The MQTT interface implements a subset of the MQTT 3.1.1 protocol.
The following features are currently not supported as defined in the standard:
Feature | Status |
---|---|
Retained Messages | Retained message are currently kept in memory and are lost when the instance is restarted. |
Persistence | Subscriptions are currently not persistent. Clients have to resubscribe to all topics. |
Clean Session | Sessions are only temporary and not persistent. Setting the flag will have no effect. |
Ports
For shiftr.io Cloud instances the interface is available over the insecure port 1883
(TCP), secure port 8883
(TLS) and secure WebSocket port 443
(WSS/HTTPS).
With shiftr.io Desktop the interface is only available over the insecure port 1883
(TCP) and WebSocket port 1884
(WS/HTTP) due to the lack of a certificate. Other ports are selected if one of the ports is already in use by another application.
Protocol Notes
- The
username
andpassword
settings are used to transmit the instance name and token secret. - The
clientId
is used as the connection name. - The wildcard
*
is automatically replaced with+
. - There is no difference between the topic
/hello
andhello
. However, the client will always receive a root slash in the message topic if the responsible subscription does so too.
Enforced Limits
- The client identifier length is limited to 64 characters.
- The topic length is limited to 128 characters.
- The topic format is limited to letters, numbers and the following special characters:
.,:;-_$/+#
. - The payload size of publish messages is limited to 64 KB.
- The active subscriptions per connection are limited to 100.
- The minimum keep alive interval is 1 second while the maximum is 5 minutes.
Message Ordering
Messages published by a MQTT client are guaranteed to be delivered in the order as they are published. However, if multiple clients publish messages to multiple topics the overall order of messages is not defined, but the observed order is guaranteed to be consistent among all connections.
Client Libraries
A list of recommended open-source client libraries:
- Arduino: https://github.com/256dpi/arduino-mqtt
- Processing: https://github.com/256dpi/processing-mqtt
- JavaScript: https://github.com/mqttjs/MQTT.js
- Go: https://github.com/256dpi/gomqtt
- Ruby: https://github.com/njh/ruby-mqtt
- C: http://www.eclipse.org/paho/clients/c/
- C++: http://www.eclipse.org/paho/clients/cpp
- Java: http://www.eclipse.org/paho/clients/java
- Python: http://www.eclipse.org/paho/clients/python