New features, such as user properties, topic aliases, and session expiry interval, are added to Message Queuing Telemetry Transport (MQTT) 5.0 based on the original version, which is MQTT 3.1.1. The features help improve the flexibility and reliability of the MQTT protocol. This topic describes the new features of MQTT 5.0.
Background information
ApsaraMQ for MQTT supports MQTT 3.1.1 and MQTT 5.0. For more information, see MQTT 5.0 and MQTT 3.1.1.
Limits
ApsaraMQ for MQTT does not support subscription sharing, will messages, or retained messages.
ApsaraMQ for MQTT Professional Edition and Enterprise Platinum Edition instances and serverless ApsaraMQ for MQTT instances support MQTT 5.0. If you want to use MQTT 5.0 for an existing ApsaraMQ for MQTT instance, submit a ticket to upgrade the instance version.
The maximum value that you can specify for the Keep Alive parameter on the broker is 8 minutes. If you specify a value that is longer than 8 minutes for the Keep Alive parameter, 8 minutes is used.
The maximum size of a message that the broker supports is 128 KB. When you send a message, the message body cannot exceed 64 KB in size.
NoteAfter the broker receives a data packet, the broker does not check the size of the data packet. Instead, the data packet is directly pushed to the broker. If you want the broker to check the size of data packets and intercept data packets whose size exceeds the maximum specified value, join the DingTalk group 116015007918 to contact ApsaraMQ for MQTT technical support.
The valid values for the Subscription Identifier parameter ranges from 1 to 268435455. If you specify a value larger than 268435455 for the Subscription Identifier parameter, subscriptions fail and error codes are returned.
The maximum value that you can specify for the Receive Maximum parameter on the client is 65535. If you specify a value larger than 65535 for the Receive Maximum parameter, 65535 is used.
If you want to use the features of MQTT 5.0, join the DingTalk group 116015007918 to contact ApsaraMQ for MQTT technical support.
For information about the limits of each feature, see the relevant documentation.
MQTT 5.0 features
Feature | Description |
The user properties feature is introduced into MQTT 5.0. You can use the feature to add extra key-value pairs in UTF-8 encoded string format in control packets. You can configure user properties for all MQTT 5.0 control packets, except for heartbeat packets. You can configure user properties to transmit additional custom information between devices and applications. | |
Most IoT devices that are connected to IoT Platform over cellular networks are sensitive to traffic and power consumption. In this case, a smaller packet that is used to transmit data can reduce traffic and power consumption. You can use topic aliases in numbers to replace topic names in strings to shorten the length of data packets. | |
In MQTT 5.0, the | |
If you configure the Message Expiry Interval parameter, expired messages stored on the broker are deleted. This feature is suitable for weak network scenarios of IoT. For example, you can use the message expiry interval feature to prevent expired commands from being sent to a device. | |
When a client subscribes to a topic, you can configure specific parameters and options, such as the quality of service (QoS), to manage and optimize message transmission. This helps meet requirements in different scenarios. | |
MQTT 5.0 provides the request-response pattern for one-on-one communication. You can use the request-response pattern in IoT device scenarios in which responses are required from subscribers. | |
The payload format indicator feature is added to messages to ensure that the publisher and the subscriber of a message have the same understanding of the data format. This helps message subscribers correctly process messages. | |
MQTT 5.0 supports various features, such as connection negotiation, optimized error codes, and broker-side initiated disconnection. This helps improve troubleshooting efficiency. |