This topic describes the concepts and terms of ApsaraMQ for MQTT and the Message Queuing Telemetry Transport (MQTT) protocol.

Basic concepts

Instance

An entity that you create when you purchase ApsaraMQ for MQTT. Each ApsaraMQ for MQTT instance maps to a globally unique endpoint URL. Before you use ApsaraMQ for MQTT, you must create an instance in the corresponding region and access the service by using the endpoint of the instance. For more information about how to create a ApsaraMQ for MQTT instance, see Quick Start.

Message Queue for MQTT broker
A broker provided by ApsaraMQ for MQTT for MQTT-based interactions. A Message Queue for MQTT broker is responsible for messaging between a Message Queue for MQTT client and ApsaraMQ for RocketMQ.
Message Queue for MQTT client
A mobile node that interacts with the ApsaraMQ for MQTT broker.
P2P message
A special type of message provided by ApsaraMQ for MQTT based on the standard MQTT protocol. This type of message can be directly sent to a Message Queue for MQTT client without going through regular subscriptions. For more information, see P2P messaging model (MQTT).
Parent topic
MQTT is a messaging protocol based on the publish-subscribe model. Therefore, each message belongs to a topic. The MQTT protocol supports multiple levels of topics. A level-1 topic is a parent topic. Before you use ApsaraMQ for MQTT, you must create a parent topic in the ApsaraMQ for MQTT console or the ApsaraMQ for RocketMQ console.
Subtopic
A level-2 or level-3 topic is a subtopic of a parent topic in Message Queue for MQTT. You can directly set subtopics in code without the need to create them in the console. Note that the total length of a parent topic and its subtopics cannot exceed 64 characters in ApsaraMQ for MQTT. Otherwise, a client exception may occur.
Client ID

A client identifier that is globally unique in ApsaraMQ for MQTT. If a client uses the same client ID as a connected client to access the ApsaraMQ for MQTT service, the access request will be denied.

A client ID consists of two parts in the format of <GroupID>@@@<DeviceID>. A client ID cannot exceed 64 characters in length and cannot contain non-printable characters. For more information, see Usage limits.

Group ID
An identifier that specifies a group of nodes with identical logic and features. A group ID represents a set of devices that have the same features. You must create a group ID in the ApsaraMQ for MQTT console before you can use it. For more information about how to create a group ID, see Quick Start.
Device ID
A unique identifier for each device that you specify. Device IDs must be globally unique. For example, you can use the serial number of a sensor device as its device ID.

Network-related terms

ServerUrl

ApsaraMQ for MQTT provides both public and internal endpoints. We recommend that you use public endpoints for mobile devices. In addition to standard MQTT port 1883, ApsaraMQ for MQTT also supports SSL encryption and WebSocket. The endpoint URL is automatically allocated after an instance is created. Record the URL for future reference. For more information about how to create an instance, see Quick Start.

MQTT-related terms

MQTT
An industry-standard protocol for the Internet of Things (IoT) and mobile Internet, which is suitable for data transmission between mobile devices. By default, ApsaraMQ for MQTT supports this protocol.
QoS
The quality of service (QoS) level in message transmission. MQTT provides the following QoS levels:
  • QoS0: Messages are delivered to intended Message Queue for MQTT clients at most once.
  • QoS1: Messages are received by intended Message Queue for MQTT clients at least once.
  • QoS2: Messages are delivered to intended Message Queue for MQTT clients exactly once.
cleanSession
In the MQTT protocol, cleanSession specifies whether a Message Queue for MQTT client wants to receive offline messages after a TCP connection is established for it. Set this parameter based on the following syntax:
  • cleanSession=true: When an offline Message Queue for MQTT client goes online again, all its previous subscriptions and offline messages are cleaned up.
  • cleanSession=false: When an offline Message Queue for MQTT client goes online again, it processes previous offline messages, and its previous subscriptions remain effective.

Take note of the following points when you use QoS and cleanSession together:

  • In the MQTT protocol, the value of cleanSession for each client cannot be modified upon each connection. Otherwise, some messages may be mistaken as offline messages.
  • In the MQTT protocol, cleanSession cannot be set to false for messages with QoS2. If a Message Queue for MQTT client subscribes to such messages, the subscription does not take effect even if cleanSession is set to false.
  • The cleanSession flag of P2P messages is subject to the configuration of the Message Queue for MQTT client that sends the messages.

Combinations of QoS levels and the cleanSession flag lists the results of different combinations of QoS levels and the cleanSession flag.

Table 1. Combinations of QoS levels and the cleanSession flag
QoS levelcleanSession=truecleanSession=false
QoS0Offline messages are not delivered. Only one delivery attempt is made for online messages.Offline messages are not delivered. Only one delivery attempt is made for online messages.
QoS1Offline messages are not delivered. Online messages are guaranteed to reach the intended Message Queue for MQTT clients.Offline messages are delivered. Both offline and online messages are guaranteed to reach the intended Message Queue for MQTT clients.
QoS2Offline messages are not delivered. Online messages are delivered once.Not supported.

Solution-related terms

RTC
A real-time network communication method for audio and video fields. This method is used in scenarios such as voice calls, video calls, and video conferencing.
RTC server
A server that hosts audio-and-video media channel services, such as related services provided by Alibaba Cloud Real-Time Communication.
Audio-and-video service management server
A management node in the RTC system, which is also called an audio-and-video management service. You can develop your own audio-and-video management services to manage the lifecycles of all RTC sessions. Such management nodes are usually deployed on Alibaba Cloud. You can use Alibaba Cloud services to deploy your audio-and-video management services.
Mobile audio-and-video application
A terminal application that is used by users in the RTC system. Users use this application to initiate or join a voice or video call.
Smart AP
A common network device that supports application programming and can simultaneously perform Internet access and LAN device management. For example, a smart router is a smart access point (AP).
Digital price tag
An electronic screen in places such as shopping malls and supermarkets. Digital price tags are networked by using a wireless sensor network protocol, such as Bluetooth or ZigBee, and smart AP nodes.
Digital price tag management service
The backend service of a digital price tag system. It is used to manage the content that is displayed on the electronic screens and to manage and query manual tasks, such as price changes.
RDS
A stable, reliable, and scalable online database service provided by Alibaba Cloud. It is used to persistently store task status changes such as price changes in a digital price tag system.
Log Service
A log storage service provided by Alibaba Cloud. This service is used to persistently store all the operation logs in a digital price tag system for auditing and tracing purposes.