These days, we take wireless connectivity for granted. For most of us, dial-up is nothing but a distant memory, even ethernet feels like a hassle… my computer doesn’t even have a port for it.  Wireless connectivity is the backbone of the Internet of Things – those Things have to get connected to the Internet somehow, right? When I started working at Andium this summer, I got curious about how all those Things do just that. As it turns out, many IoT technologies use a lightweight, efficient, and standardized communication protocol called MQTT to get all those Things talking.

So, what is MQTT? It’s what’s called a machine-to-machine connectivity protocol – it facilitates communication between different devices in an extremely efficient way. In fact, its earliest use, upon being invented at IBM in 1999, was connecting oil pipelines over satellite link for real-time data transmission. Unsurprisingly, satellite technology in the ‘90s wasn’t quite as robust as it is today, so the team at IBM (led by Andy Stanford-Clark and Arlen Nipper) had to create a connectivity protocol that used up very little power and bandwidth. This left more room to send the data that mattered.

MQTT originally stood for “Message Queue Telemetry Transport” – now, it’s known just by the acronym. In the early days, MQTT was only really used on embedded devices in industrial settings. As time went on, embedded devices weren’t only found in industrial technology; now, embedded devices powerful enough to sense the world around them and communicate that data are everywhere, from your thermostat to your microwave. Those devices (the things in IoT) have a lot of the same constraints – including power and bandwidth – that MQTT set out to address. In 2011, MQTT was released to the open-source community and since has quickly become the connectivity-protocol-of-choice for IoT.

If MQTT was so revolutionary, it must be pretty complicated… right? Wrong! Like many great technologies, MQTT thrives because it’s simple. MQTT is a type of “pub/sub” protocol, meaning that it’s based on a system of publishers and subscribers. When a device publishes a message, it sends the message, along with its topic, to a broker. The broker then takes that message and sends it to every subscriber device that is subscribed to the topic of the message. (Topics effectively work like channels on Slack or hashtags on Twitter, separating out messages into different groups). MQTT is efficient in power and bandwidth because the broker handles all of the routing and distribution of messages. All the devices that need to talk to each other (called clients in MQTT-speak) communicate only with the broker; this means that the messages only need to contain topic, data, and a tiny bit of extra overhead, rather than all the information about who is receiving the data and how it is getting there.

MQTT even includes security measures to help protect the data it transports. Username/password authentication is included out-of-the-box in the protocol that connects clients to the broker. MQTT works nicely with TLS/SSL too, allowing messages to be encrypted during transport. Security measures like these add a small amount of overhead to the protocol, but that overhead becomes negligible once clients have been connected to a broker for a reasonable amount of time.

We know that MQTT has been used in industry and that it’s common in IoT. As it turns out, more than a billion people use MQTT regularly, without even realizing it. Facebook uses MQTT to power its Facebook Messenger mobile app. MQTT is perfect for a mobile chat application; not only is it efficient with both battery and data, the pub/sub nature of MQTT works perfectly for both individual and group chats. For us at Andium, MQTT has been pretty dang useful too – so much so that we’ve implemented our own brokers and clients straight into our core Andium architecture!

MQTT is an important technology with a huge community around it; while this post has only scratched the surface, you can learn a ton about MQTT with just a few simple google searches. There are tons of resources where you can learn the essentials of MQTT and MQTT security. If you learn by doing like me, check out this Hackster project and follow along as I set up a local MQTT broker and make a terminal chat app using open-source TLS/SSL MQTT tools.