Friday, March 29, 2024

Campus Buzz

A paramount protocol to study for Research in a field of IoT for Research scholars is MQTT

PUNJAB NEWS EXPRESS5 | May 17, 2023 04:20 PM

By Anil Behal
MQTT (Message Queuing Telemetry Transport) is a lightweight messaging protocol that has gained widespread popularity in the Internet of Things (IoT) world. It was developed in the late 1990s by IBM to enable devices with limited processing power and bandwidth to communicate with each other over networks with low data rates and high latency. MQTT is a publish-subscribe protocol that allows devices to send and receive messages in a scalable and efficient manner.

It is designed to be simple, reliable, and efficient, making it an ideal choice for IoT applications where resources are limited. The key difference between MQTT and other traditional forms of network communication is that in traditional network communication the client and the server communicate directly with each other, the client sends a resource request to the server, the server processes it and then sends back a response whereas in MQTT the message sender (publisher) and the message receiver (subscriber) are decoupled and a third component, i.e. the message broker processes and handles the communication between them.

There are 3 types of decoupling occurring in this system:
1.Spatial Decoupling- Due this the publisher does not directly address the receiver but sends it through a channel and both the parties are unaware of each other’s IP addresses or port numbers.
2. Synchronization Decoupling- Due to this the operations on both the subscriber end or the publisher end do
not need to be interrupted during subscribing and publishing.
3. Time Decoupling- Due to this the publisher and subscriber are time independent of each other and do not need to be running at the same time. The MQTT system is made up of 3 key components, those are:
1. MQTT Client-Any device that communicates using the MQTT network can be referred to as a client. A client can be any device ranging from a server to a micro-controller running an MQTT library. If the client is
sending messages, it acts as a publisher and if the client is receiving messages, it acts as a receiver.
2. MQTT Broker-An MQTT broker is the backend system responsible for the coordination of messages between the different clients.
3. MQTT Connection- For the client and broker to communicate an MQTT Connection is necessary. The client initiates the connection by sending CONNECT message to the broker, the broker then confirms the connection by sending CONNACK message to the client. The working of MQTT is discussed below:
1. An MQTT client initiates connection with the broker.
2. The broker confirms and establishes a connection.
3. Once connected, the client is then ready to publish or receive messages.
4. The publisher sends a message to a broker with a specific topic or channel.
5. The broker delivers the message to all subscribers who have subscribed to that topic or channel.

A topic is a string that serves as a label or identifier for the message, and subscribers can subscribe to multiple topics to receive only the messages that are relevant to them.

Topics are hierarchical and use a forward-slash (/) as a separator. For example, a topic could be “sensors/temperature” or “devices/lights/Livingroom”. Publishers and subscribers do not need to know each other’s addresses but they must have a shared understanding of the topic hierarchy.

About the author: Assistant Professor CSE at Chandigarh university working in Academic Unit-5 at Block C3

Have something to say? Post your comment