MQTT in a Nutshell

— Part One, What is it

M2M and Internet of Things

Lots of people are already using Internet of Things, some of them are just not aware of it. Recently I’ve visited a friend, he was quite excited about his new smart oven and can’t wait to show me how smart the oven is: Recipe was downloaded to the smartphone and sent to the oven via WiFi; during the baking it was remotely adjustable via a smartphone app; when the baking was done, the oven sent notice to the smartphone. Well, he is already in the IoT era.

Why MQTT

One key element of IoT is, that the “things” have the ability to connect. They need a common language that everybody understands, a connectivity protocol. There are already a lot of connectivity protocols in the world, over the years, some protocols like http are used by millions of applications. Why not just one of the widely used protocols? Why MQTT for IoT?

A little History about MQTT

MQTT stands for MQ Telemetry Transport. It was first invented by Andy Stanford-Clark and Arlen Nipper in 1999. They were on a pipeline SCADA system (where the word Telemetry came from) and needed real-time delivery of data on satellite link and dial-up line to connect the remote pipelines. With these constrained resource they start to talk about a new publish and subscribe protocol, that is MQTT.

MQTT v.s. XMPP

Comparing the MQTT with other protocols may make it much easier to understand why the MQTT is suitable for the IoT, here we compare it with XMPP, another messaging protocol from the later nineties.

  1. MQTT uses a one-byte fixed header and two-byte KeepAlive packet, its packet has a size and simple to en/decode. While XMPP is encapsulated in XML, it is large in size and complicated in interaction.
  2. MQTT uses topic for routing, it is more flexible than XMPP’s peer to peer routing based on JID.
  3. MQTT protocol doesn’t define a payload format, thus it carries different higher level protocol with ease. While the XMPP uses XML for payload, it must encapsulate binary in Base64 format.
  4. MQTT supports message acknowledgement and QoS mechanism, which is absent in XMPP, thus MQTT is more reliable.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
EMQ Technologies

EMQ is an open-source IoT data infrastructure software provider, delivering the world’s leading open-source MQTT message broker and stream processing database.