MQTT v5.0 specification
The cross-industry MQTT Technical Committee have been working on the MQTT v5.0 specification over the last few years, looking at how MQTT can be improved without sacrificing the key features that have made it so popular.
Members of the Oasis standards body recently voted to make it into a fully ratified standard and it has now been published as an Oasis Standard.
To use the MQTT v5.0 features, you’ll need client code which supports MQTT v5.0. The C open source eclipse client hosted at Paho has been updated for version 5.0, you can find and download it here.
A quick guide on getting started quickly with MQTT v5.0 and Watson IoT Platform with the C client is here.
The Watson IoT Platform retains full backward compatibility for MQTT v3 and v3.1.1 clients.
MQTT v5 features
The major objectives of MQTTv5 are:
- Enhancements for scalability
- Improved error reporting
- Formulate common patterns including capability discovery
- Extensibility mechanisms including user properties
- Performance improvements and support for small clients
- Error reporting
- Better error reporting makes it easier for the client to understand why something didn’t work, such as a refused connection or failed publish.
- Topic alias
- Topic alias saves bytes on the wire. It works by decreasing the size of MQTT data by encoding long topic names into a short integer encoding. In most clients this is seamless and fully hidden from the client application.
- Message expiry
- Allow a message to expire without being delivered based on an expiration time set in the message. This is particularly useful if a message you are sending is only important to the device if it’s online. For example when unlocking car doors, you could send a message and ensure that it only takes effect if it’s delivered within 5 seconds.
- Message properties including user properties
- Add message properties to the message header such as whether the content is text or binary, the content type, and application defined user properties. This metadata can be changed without modifying the message content. This enables rapid routing in the backend application without needing to parse the payload of the message. Another use for this is when the payload is encrypted and some information is included in the header outside the encrypted envelope to help with processing.
- New session start and expiry support
- Allows the client to control how long a session lasts by indicating whether to start a new session on connect, and how long after a disconnect to keep a session.
- Subscription identifiers
- Allow a subscription to be tagged with an identifier which is returned along with the messages received by the subscription. This allows for routing of messages internally in the client application.
- Capability discovery
- This allows the client to discover the capabilities of the MQTT server. Many of these capabilities are handled by the client library but are made available to the client application. For instance the server will send to the client the maximum packet size it will accept.
More details of our MQTT support can be found in the product documentation.