MQTT, or Message Queue Telemetry Transport, is a lightweight and simple messaging protocol targeted specifically for IoT applications. While a Raspberry Pi is powerful enough to leverage more complex messaging protocols, if you are using it as part of a distributed IoT solution, chances are you are going to encounter MQTT; hence, learning it is very important. Besides, its simplicity and open nature make it easy to learn and use.
Our introduction to MQTT is going to be performed using a popular open source MQTT broker called Mosquitto that we will install on your Raspberry Pi.
The examples we cover in this chapter were performed with the Mosquitto broker and client version 1.5.7, which are MQTT protocol version 3.1.1-complaint. A different version of the broker or client tools will be suitable as long as they are MQTT protocol version 3.1.x-compatible.
To install the Mosquitto MQTT broker service and client...