In this chapter, we have explored and practiced the core concepts of MQTT. After installing and configuring the Mosquitto MQTT broker on your Raspberry Pi, we moved straight into learning a range of examples on the command line. We learned how to publish and subscribe to MQTT messages, how to understand topic construction and name hierarchies, and how we can attach a QoS level to a message.
We also covered durable connections and retained messages, two mechanisms offered by MQTT brokers for storing messages for later delivery. We concluded our walk-through of MQTT concepts by exploring a special message and topic type known as a Will, whereby a client can register a message with a broker that gets automatically published to a topic in cases where the client abruptly loses its connection.
Next, we reviewed and walked through a Python program that used the Paho Python MQTT library to subscribe to an MQTT topic and control the brightness of our LED in response to the messages...