MQTT 5.0 overview

更新时间:
复制 MD 格式

MQTT is a lightweight IoT protocol for reliable, low-bandwidth device communication. MQTT 5.0 extends the protocol to improve scalability, interoperability, and device-cloud interactions.

Background

IoT Platform supports MQTT 5.0, MQTT 3.1.1, and MQTT 3.1.

IoT Platform provides a standard MQTT broker that supports server-side subscription, data forwarding, and the IoT Platform SDK for efficient cloud application development. For more information, seeServer-side subscription, Data forwarding, and Overview.image..png

Limits

A registered device can connect to IoT Platform using only one protocol version. If a device connects over MQTT 5.0, it cannot switch to MQTT 3.1 or MQTT 3.1.1.

MQTT 5.0 features

MQTT 5.0 extends MQTT 3.1.1 with improved performance, scalability, and interoperability, without increasing resource consumption or reducing usability.image..png

Feature

Description

User properties

Attach custom key-value properties to message headers, similar to HTTP headers.

Topic alias

Replaces lengthy topic names with four-byte integer aliases to reduce bandwidth usage.

Session expiry

Sets a time-to-live for session state after a device disconnects from the server.

Message expiry

Sets a time-to-live for published messages so subscribers do not receive expired messages.

Will Message

Delivers a predefined message to subscribers when a device disconnects unexpectedly.

Retained messages

Stores the latest published message on a topic for delivery to new subscribers.

Shared subscription

Distributes messages on a topic across multiple subscribers for load balancing.

Subscription options

Provides fine-grained subscription controls to filter messages and reduce unnecessary traffic.

Request-response pattern

Enables request-response communication over MQTT, similar to HTTP RPC calls.

Message format properties

Declares the payload format of a message, enabling transparent forwarding and variable-format payloads.

Optimized interaction between edges and clouds

Adds connection feedback, refined error codes, and server-initiated disconnection for faster troubleshooting.