CHAPTER 1: HEADLINE
CHAPTER 2: MQTT TOPICS
2.1 TOPIC PRINCIPLE
Communication in MQTT is based on the topic principle. An MQTT topic is a UTF-8 string that the broker uses to filter
messages for each connected client. To receive messages, the client must subscribe to the topic. A topic can have
one or more topic levels. Each topic level is separated by a slash.
Each topic must contain at least one character. The topic string permits empty spaces, and topics are case-sensitive.
Figure 2-1 illustrates a topic with multiple topic levels.
Topics support wildcard characters. When subscribing to a topic, the user can either subscribe to the exact topic of a
published message or can use wildcards to subscribe to multiple topics simultaneously. A wildcard can only be used
to subscribe to topics, not to publish a message. There are two different kinds of wildcards: single-level and multi-
level.
2.1.1 SINGLE-LEVEL WILDCARD - REPLACES ONE TOPIC LEVEL: +
A single-level wildcard replaces one topic level by using a "+" sign. Figure 2-2 illustrates a topic with a wildcard.
FIGURE 2-1: TOPIC LEVELS
FIGURE 2-2: WILDCARD EXAMPLE
1.877.877.2269
1.877.877.2269
BLACKBOX.COM
BLACKBOX.COM
NEED HELP?
LEAVE THE TECH TO US
LIVE 24/7
TECHNICAL
SUPPORT
1.877.877.2269
5