All Products
Search
Document Center

IoT Platform:MQTT 5.0 overview

Last Updated:Oct 31, 2023

Message Queuing Telemetry Transport (MQTT) is a lightweight IoT protocol that significantly reduces the requirements for network bandwidth and device resources and ensures reliable data transmission. MQTT is one of the most widely used protocols in the IoT industry. As the number of IoT devices and the number of IoT scenarios increase, MQTT 5.0 is developed to meet the requirements of new scenarios. This topic describes the features of MQTT 5.0.

Background information

IoT Platform supports MQTT 3.1, MQTT 3.1.1, and MQTT 5.0. For more information, see MQTT 5.0, MQTT 3.1.1, and MQTT 3.1.

IoT Platform supports the standard MQTT broker feature. The server-side subscription, data forwarding, and IoT Platform SDK features are developed based on the MQTT broker feature. This way, you can develop cloud applications with high efficiency. For more information, see Server-side subscription, Data forwarding, and Overview.image..png

Limits

After you register a device, you can use only one protocol to connect the device to IoT Platform. You cannot use multiple protocols for the same device. If you connect a device to IoT Platform over MQTT 5.0, you can no longer connect the device to IoT Platform over MQTT 3.1 or MQTT 3.1.1.

MQTT 5.0 features

MQTT 5.0 supports more features than MQTT 3.1.1 and improves the performance, scalability, and interoperability of devices without increasing resource consumption and reducing usability.image..png

Feature

Description

User properties

Message headers are similar to HTTP headers. You can specify custom properties in the key-value format and use extensible message properties.

Topic aliases

MQTT 5.0 uses a four-byte integer to replace a topic name of a longer length to reduce resource consumption.

Session expiry

You can specify a period of time for which you want to store information about a session between a device and the corresponding server when the device is disconnected.

Message expiry

You can specify a validity period for messages that you want to publish. This prevents subscribers from receiving expired messages.

Will messages

When a device is unexpectedly disconnected, subscribers can still receive the messages that are published by the device.

Retained messages

You can specify messages that are published by a device as retained messages. This way, new subscribers can receive the retained messages.

Shared subscription

Multiple subscribers can consume the messages of a topic. This helps you build a load balancing system.

Subscription options

You can specify various subscription options. This helps remove excessive information to improve the efficiency of transmission.

Request-response pattern

The request-response pattern works the similar way RPC calls of HTTP work.

Message format properties

Properties that specify the payload format of messages are added. This way, you can forward messages in a transparent manner and send messages whose payloads are variable.

Optimized interaction between edges and clouds

MQTT 5.0 supports various features, such as connection feedback, optimized error codes, and server-side initiated disconnection. This helps improve troubleshooting efficiency.