Quick definition#

MQTT is one of the most popular protocol when it comes to IoT and communications between nodes. It is based on the principe of publisher - subscriber. A broker, which can be seen as a server, is responsible to route all messages from a publisher to all registered subscribers. It provides advanced functions like a last will and testament options, as well as 3 different quality of service levels.


A MQTT system is composed at least of 3 nodes so that it is useful (well, a broker alone or a broker + publisher or even a broker + subscriber would definitely work, but it won’t really useful…) :

  1. Broker : kind of the server, routes messages from publisher to subscriber(s), manages quality of services, …

  2. Clients :

    1. publisher : typically a sensor, publishes data most likely formatted as a JSON string on a topic.

    2. subscriber : get all messages of the topic(s) it is subscribed to, typically a node on the cloud that will store data in a database.

The topics are kind of communication channels that each client can subscribe to.

MQTT overview,

MQTT communication, source :


Find an example of a broker and clients for Linux in Linux, MQTT

For client examples in python, see Python, MQTT

Protocols MQTT Python