MQTT is a broker-based publishing and subscription messaging protocol (frequently paraphrased as pub/sub), while an MQTT broker (just like the Mosquitto MQTT broker we installed in the previous section) is a server that implements the MQTT protocol. By using an MQTT-based architecture, your applications can essentially hand off all complex messaging handling and routing logic to the broker so they can remain solution-focused.
MQTT clients (for example, your Python programs and the command-line tools we are about to use) create a subscription with the broker and subscribe to message topics they are interested in. Clients publish messages to a topic, and it is the broker that is then responsible for all message routing and delivery assurances. Any client may assume the role of a subscriber, a publisher, or both.
A simple conceptual MQTT-based system involving a pump, water tank, and controller application is illustrated in...