All Products
Search
Document Center

ApsaraMQ for MQTT:Overview

Last Updated:Apr 08, 2025

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.

    Note

    After 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

User properties

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.

Topic aliases

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.

Session expiry interval

In MQTT 5.0, the cleanSession parameter is changed to the cleanStart parameter, and the Session Expiry Interval parameter is added. If you set the cleanStart parameter to false and configure the Session Expiry Interval parameter during connection, disconnected sessions can be restored if the client reconnects to MQTT 5.0 before the session expiry interval elapses. If you set the cleanStart parameter to true, disconnected sessions are immediately deleted.

Message expiry interval

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.

Subscription options

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.

Request-response pattern

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.

Payload format indicator

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.

Optimized device-cloud interactions

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