==== MQTT ==== .. contents:: :local: 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. Description =========== 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 : a. publisher : typically a sensor, publishes data most likely formatted as a JSON string on a topic. b. 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. .. figure:: img/mqtt_overview.* :align: center :alt: MQTT overview, :width: 500px MQTT communication, source : https://www.eclipse.org/community/eclipse_newsletter/2014/october/article2.php Examples ======== Find an example of a broker and clients for Linux in :doc:`Linux, MQTT ` For client examples in python, see :doc:`Python, MQTT ` :tag:`Protocols` :tag:`MQTT` :tag:`Python`