MQTT topics

As discussed earlier, a topic is routing information, which is used by the client for publishing and subscribing to messages. Topics are represented by strings and can have one or more levels. Each topic level is separated by a forward slash (/). A topic is created as soon as a client sends data on it, so it is not necessary to create the topic explicitly. Let's understand it with an example. Consider Figure 3.9. We have two Air Conditioners (ACs) at home; one is in the dining room and the other is in the bedroom:

Figure 3.9

Both the ACs are connected to the broker and we have a mobile application that communicates to the AC using ...

Get Internet of Things with Raspberry Pi 3 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.