Skip to content

IoT MQTT5 supported features

AWS

Persistent Sessions (Clean Start and Session Expiry)

Persistent session is an MQTT 3.1 feature but it can be controlled with the combination of “cleanstart” flag in MQTT 5 which enables clients/devices to resume or discard the persistent session. For more details, refer to the AWS documentation.

Retained Messages

  • A message can be retained in a topic by enabling the Retain flag while message payload is published.

  • All subscribers of the topic in which the message is retained will receive the last retained message of the topic.

  • Retained messages can be viewed by applications using GetRetainMessage API.

  • Retained messages can be deleted by publishing an empty message with retain flag enabled.

Refer to Topics API for more details.

Use Cases of Retained Messages

  • As an initial configuration message
  • As a last-known state message

Last Will and Testament (LWT) messages

Devices can configure the LastWill topic and LastWill message while initiating a Connection, which will be published to all subscribers if an uninitiated disconnection occurs.

Example

LastWill Topic{groupId}/last-will
LastWill Message Payload{“disconnectReason”:”Network Unavailable”}

 

Shared Subscriptions

Refer to the Shared Subscriptions documentation.

 

Reason Codes on Acknowledgments

Reason codes are returned based on the type of interaction with the broker (Subscribe, Publish, and Acknowledge).

Topic Alias

Topic name can be substituted with topic alias, which is a two-byte integer.

Topic aliases can optimize the transmission of topic names to potentially reduce MQTT payload size which in turn reduces the cost.

Refer to quotas and limits for topic alias limits.

Maximum Packet Size

Clients can specify the maximum packet size that they support.

Message Expiry

Message expiry intervals can be added to messages when published.

If the messages haven’t been sent to the subscribers within that interval, the message will expire and be removed.

If you do not set the message expiry value, the message will not expire.

Refer to quotas and limits for limits on message expiry interval.

MQTT5 Properties

User properties and system properties are supported in IoT 2.1. Refer to the following table for details:

PropertyDescriptionInput Type
Payload format indicatorA boolean value that indicates whether the payload is formatted as UTF-8.Byte
Content TypeA UTF-8 string that describes the content of the payload.UTF-8 string
Response TopicA UTF-8 string that describes the topic the receiver should publish to as part of the request-response flow. The topic must not have wildcard characters.UTF-8 string
Correlation DataBinary data used by the sender of the request message to identify which request the response message is for.Binary
User PropertyA UTF-8 string pair. This property can appear multiple times in one packet. Receivers will receive the key-value pairs in the same order they are sent.4-byte integer
Message Expiry IntervalA 4-byte integer that represents the message expiry interval in seconds. If absent, the message doesn’t expire.4-byte integer
Session Expiry IntervalA 4-byte integer that represents the session expiry interval in seconds. AWS IoT Core supports a maximum of 7 days, with a default maximum of one hour. If the value you set exceeds the maximum of your account, AWS IoT Core will return the adjusted value in the CONNACK.4-byte integer

Refer to quotas and limits for limits on system and user properties.

 

AZURE

MQTT5 protocol specification is not supported yet in Azure.