What is MQTT Protocol and its working?

Overview

Sarthak Dave
2 min readFeb 6, 2021

MQTT (Message Queuing Telemetry Transport) is an open OASIS and ISO Standard (ISO/IEC 20922) lightweight publish/subscribe messaging protocol designed of M2M i.e. Machine to Machine telemetry in low bandwidth environments. The MQTT protocol runs over TCP/IP but any other network protocol which can provide lossless, bi-directional and ordered connections can support MQTT Protocol.

Andy Stanford-Clark (IBM) and Arlen Nipper in 1999, designed the MQTT protocol.

How Does MQTT Protocol Work? (Publish / Subscribe Model)

Consider the below figure depicting the architecture of the MQTT Publish / Subscribe Model

MQTT Architecture (Publish / Subscribe Model)

The MQTT Protocol defines three type of entities

  1. MQTT Broker
  2. Publisher
  3. Subscriber

The MQTT Broker is a server which receives any message that is published by a publisher and it routes that message to the subscriber subscribing for that topic.

Then comes the publisher. The publisher is a device which publishes a message with a specific topic.

Now the subscriber is a device which subscribes to a particular topic and receives the message intended for the topic subscribed.

Now coming to the working of MQTT protocol as explained below.

  1. A device connects to the MQTT Broker and subscribes to a topic in that broker. This connection can either be a plain TCP/IP Connection or it can be an encrypted TLS Connection.
  2. A device then publishes a message for a topic and sends that message along with the topic to the broker.
  3. The broker then sends the message published from the publisher to all the devices subscribing to that topic.

Here a device can be a publisher as well as a subscriber. Also a device can subscribe to multiple topics.

Advantages of MQTT Protocol

MQTT Protocol brings with itself many powerful advantages:

  1. Increase Scalability.
  2. Extremely Lightweight.
  3. Efficiently distributes information with reduced network bandwidth.
  4. Saves development time.
  5. The flexibility of this protocol makes it possible to support varied application scenarios for IOT devices and services.

--

--

Sarthak Dave

I am an aspiring software engineer with experience in diverse IT technologies and passionate about IOT and AI