A short intro.

Since MQTT is growing more and more and someone says that it will be the standard protocol for the IoT, I’m going to write a serie of posts on this protocol.

This serie of posts won’t be a user or a reference manual, but, instead it could be read as a survival manual. So in this first post im going to write some notions, in future posts I’m going to show:
1. Some implementations
2. how to use MQTT on MCU
3. how to use MQTT or smartphones
4. MQTT competitors
5. more

MQTT (Message Queue Telemetry Transport) is a machine-to-machine (M2M)/”Internet of Things” connectivity protocol. MQTT is a lightweight broker-based publish/subscribe messaging protocol running on top of the TCP/IP protocol.

It uses a message broker to deliver messages to subscribed clients.

The first version of the protocol was released in 1999 by Andy Stanford-Clark and Arlen Nipper.

In 2013 IBM submitted MQTT v3.1 to the OASIS specification body with a charter that ensured only minor changes to the specification could be accepted.

There is, also, a variation of the protocol working on non TCP/IP networks, this version is named MQTT-SN. This version can be used on ZigBee based networks.

How it works

In a few words:

Each client can publish data on the network providing a topic and a content (the message). The client is connected with the broker, and only with the broker, so it sends its messages to the broker.
Each client can also receive a message sent by other clients subscribing to the topic specified by the publisher. In the real world, the broker sends the messages to the clients that have subscribed to that specific topic.



All messages are published with a Quality of Service value:
QOS_0: “At most once”, where messages are delivered according to the best efforts of the underlying TCP/IP network. Message loss or duplication can occur. This level could be used, for example, with ambient sensor data where it does not matter if an individual reading is lost as the next one will be published soon after.
QOS_1: “At least once”, where messages are assured to arrive but duplicates may occur.
QOS_2: “Exactly once”, where message are assured to arrive exactly once. This level could be used, for example, with billing systems where duplicate or lost messages could lead to incorrect charges being applied.

If you want more detailed information about the mqtt protocol, you can refer to www.mqtt.org and everywarecloud.eurotech.com
There are a lot of others sources to learn a lot about the protocol but I consider the two links above the starting point.