هذه الصفحة غير متوفرة حاليًا بلغتك المحلية. نحن نعمل جاهدين على إضافة المزيد من اللغات. شاكرين تفهمك ودعمك المستمر لنا.

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

MQTT(S) Access

Updated on 2024-12-31 GMT+08:00

Overview

An MQTT message consists of fixed header, variable header, and payload.

For details on how to define the fixed header and variable header, see MQTT standard specifications. The payload can be defined by applications in UTF-8 format, that is, by the devices and IoT platform.
NOTE:

For details about MQTT syntax and APIs, see MQTT standard specifications.

Common MQTT message types include CONNECT, SUBSCRIBE, and PUBLISH.

  • CONNECT: A client requests a connection to a server. For details about main parameters in the payload of a CONNECT message, see Device Connection Authentication.
  • SUBSCRIBE: A client subscribes to a topic. The main parameter Topic name in the payload of a SUBSCRIBE message indicates the topic whose subscriber is a device. For details, see Topics.
  • PUBLISH: The platform publishes a message.
    • The main parameter Topic name in the variable header of a PUBLISH message indicates the topic whose publisher is a device. For details, see Topics.
    • The payload contains the data reported or commands delivered. It is a JSON object.

Topics

If you connect devices to the platform using MQTT, you can use topics to send and receive messages.

  • Topics starting with $oc are preset system topics in IoTDA. You can subscribe to and publish messages through these topics. For details about the topic list and functions, see Topics.
  • You can create topics that do not start with $oc to send and receive custom messages.

Constraints

Description

Limit

Number of concurrent connections to a directly connected MQTT device

1

Connection setup requests of an account per second on the device side

Number of upstream requests for an instance per second on the device side (when average message payload is 512 bytes)

Number of upstream messages for an MQTT connection

50 per second

Bandwidth of an MQTT connection (upstream messages)

1 MB (default)

Length of a publish message sent over an MQTT connection (Oversized messages will be rejected.)

1 MB

Standard MQTT protocol

MQTT v5.0, MQTT v3.1.1, and MQTT v3.1

Differences from the standard MQTT protocol

  • Not supported: QoS 2
  • Not supported: will and retain msg

Security levels supported by MQTT

TCP channel and TLS protocols (TLS v1, TLS v1.1, TLS v1.2, and TLS v1.3)

Recommended heartbeat interval for MQTT connections

Range: 30s to 1200s; recommended: 120s

MQTT message publish and subscription

A device can only publish and subscribe to messages of its own topics.

Number of subscriptions for an MQTT connection

100

Length of a custom MQTT topic

128 bytes

Number of custom MQTT topics added to a product

10

Number of CA certificates uploaded for an account on the device side

100

Compatibility

IoTDA supports device access using MQTT 5.0, MQTT 3.1.1, and MQTT 3.1. However, IoTDA is not a simple MQTT broker. It also integrates capabilities such as message communications, device management, rule engine, and data forwarding. The differences between the MQTT function provided by IoTDA and standard MQTT specifications are as follows:

  • Devices can communicate with IoTDA using CONNECT, CONNACK, PUBLISH, PUBACK, SUBSCRIBE, SUBACK, UNSUBSCRIBE, UNSUBACK, PINGREQ, PINGRESP, and DISCONNECT packets in MQTT specifications.
  • IoTDA supports MQTT QoS 0 and QoS 1, but does not support QoS 2.
  • IoTDA supports clean sessions.
  • IoTDA does not support the will feature. IoTDA can push device statuses. After a device goes offline, IoTDA pushes its status to your application or other cloud services based on a forwarding rule.
  • IoTDA does not support retained messages. IoTDA can cache messages during message reporting and delivery.

Supported MQTT 5.0 Features

NOTE:

Only enterprise edition instances support MQTT 5.0-related features.

IoTDA supports the following new MQTT 5.0 features:

  • Topic aliases. Message communication topics are reduced to an integer to reduce MQTT packets and save network bandwidth resources.
  • Response topics and correlation data. The two parameters can be carried during message reporting and delivery to implement cloud HTTP-like requests and responses.
  • User property list. Each property consists of a key and a value and is used to transmit property data in the non-payload area.
  • Content-Type. Message reporting packets can carry Content-Type to identify the packet type.
  • Return codes can be carried in CONNACK and PUBACK packets, helping devices quickly locate request statuses and issues.

TLS Support for MQTT

TLS is recommended for secure transmission between devices and the platform. Currently, TLS v1.1, v1.2, v1.3, and GMTLS are supported. TLS v1.3 is recommended. TLS v1.1 will not be supported in the future. GMTLS is supported only by the enterprise edition using Chinese cryptographic algorithms.

When TLS connections are used for the basic edition, standard edition, and enterprise edition that support general cryptographic algorithms, the IoT platform supports the following cipher suites:

  • TLS_AES_256_GCM_SHA384
  • TLS_AES_128_GCM_SHA256
  • TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
  • TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
  • TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA
  • TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA

When the enterprise edition that supports Chinese cryptographic algorithms uses TLS connections, the IoT platform supports the following cipher suites:

  • ECC_SM4_GCM_SM3
  • ECC_SM4_CBC_SM3
  • ECDHE_SM4_GCM_SM3
  • ECDHE_SM4_CBC_SM3
  • TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
  • TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
  • TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
  • TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
NOTE:

CBC cipher suites may pose security risks.

Service Flow

MQTT devices communicate with the platform without data encryption. For security purposes, MQTTS access is recommended.

You are advised to use the IoT Device SDK to connect devices to the platform over MQTTS.

  1. Create a product on the IoTDA console or by calling the API Creating a Product.
  2. Register a device on the IoTDA console or calling the API Creating a Device.
  3. The registered device can report messages and properties, receive commands, properties, and messages, perform OTA upgrades, and report data using custom topics. For details about preset topics of the platform, see Topic Definition.
NOTE:

You can use MQTT.fx to debug access using the native MQTT protocol. For details, see Developing an MQTT-based Smart Street Light Online.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback