Messaging protocols for IoT – A Comparison

by Mar 31, 2020MQTT

IoT is all about a group of devices communicating with each other and the cloud through the internet, but how is this even possible? Data that is generated by a device has to be sent to the cloud through a medium – the internet. The rules that are followed to exchange this data are called the messaging protocols.

The IoT devices use these messaging protocols at various levels for communication. There is a wide variety of protocols to choose from, in this article we will look at four of the most used protocols in today’s world namely MQTT, DDS, XMPP and HTTP. The choice of messaging protocols depends mainly on your use case. Here we will compare the protocols on the basis of a few key parameters relevant to IoT.

Contents

  1. Protocols in Brief
  2. Factors of Comparison
  3. Comparison Table
  4. Conclusion

Protocols in Brief

MQTT

MQTT is a messaging protocol that stands for Message Queue Telemetry Transport. This messaging protocol is a publish-subscribe based messaging protocol and is extremely simple to use. It is usually used to connect a huge number of IoT devices together. This protocol is one of the most commonly used in the industry. MQTT is a message centric protocol. MQTT is known for its low power consumption and hence can save battery on IoT devices. It also sends very few data packets and hence has low network usage.

DDS

Another frequently used messaging protocol is DDS. DDS stands for Data Distribution Service. It enables scalable, real-time, reliable, high performance and interoperable data exchanges between publishers and subscribers. DDS is also a data centric protocol. DDS is also one of the only protocols that is both data centric and provides extensive support for QoS (Quality of Service).

XMPP

XMPP itself is very robust and powerful, owing mostly to its standardized and decentralized nature. It stands for Extensible Messaging and Presence Protocol. This messaging protocol is based on the Extensible Markup Language (XML). XMPP is a Message Centric protocol. It also has no provision for Quality of Service (QoS). XMPP is also extendable and adaptable, allowing for the creation of bots in the lines of IRC bots.

HTTP

HTTP stands for Hyper Text Transfer Protocol. It has been extensively used to maintain connection between a client and web-server. It sends data over in the ASCII format and hence the message sizes are comparatively bigger. HTTP is also a document centric transfer protocol.

Factors of Comparison

Here is a brief description for the factors considered in the comparison of the previously mentioned protocols.

Centricity

Centricity of a protocol defines the broad purpose and use case of that protocol. It is mainly of three types – Data Centric, Message Centric and Document Centric.

  • Data Centric

In a data centric system the focus is mainly on the data defined by the user. The unit of exchange in this type of system is the data.

  • Message Centric

A message centric system requires the users to share data through the exchange of messages. This makes message centric systems a little harder to maintain as it requires the user to spend time writing message handling logic

  • Document Centric –

A document centric system is that system in which the major data type that gets transferred is documents. HTTP has for long been used to transfer HTML documents around the web. Essentially HTTP was built keeping in mind the transfer of documents rather than messages or data (which is important for IoT).

Quality of Service (QoS)

The Quality of Service (QoS) is an agreement between the sender of a message and the receiver of a message that defines the guarantee of delivery for a specific message. Here we will compare whether each of the protocols has a provision to support QoS software.

Transport

Software at the transport layer is responsible for establishing temporary communication sessions between two application programs, and delivering data as requested by those applications.

The Transmission Control Protocol (TCP) is used for applications in which reliable connections between hosts are necessary. TCP checks for transmission errors, lost packets, packets out of order, etc

The User Datagram Protocol (UDP), is an unreliable transport protocol with no sessions or flow control and optional error checking. UDP just sends packets as soon as requested and forgets about them. However, it is faster than TCP

In this comparison we will figure out what transfer protocols are being used in each of the protocols.

Security

IoT relies majorly on communication of data and wherever there is communication there is a requirement for security. However, the extent of this requirement can vary from one use case to another. In this article we will see how secure each of the protocols performs.

Real Time

This factor depends heavily on your use case and level of optimization that you prefer in your IoT project. Real time data (in most cases) tends to take up more space in the data base that you are storing the data in and can consume more power. Yet real time data is essential in certain cases. In this comparison we will look into whether each of these protocols supports real time data transfer.

Architecture

The architecture of a messaging protocol in IoT builds its fundamental principles; this principle describes how a protocol works and behaves under different situations. It also tells us the best way to use a particular protocol. Here we will mention the architecture of each of the protocols so that it can help you choose the best one for your use case.

Performance

The performance of a protocol can be judged by the approximate number of messages per second per subscriber or the number of requests per second (in the case of HTTP). This can be a major factor in choosing what protocol best suits your need.  

iot protocol comparison
IoT Protocol Comparison Table

Conclusion

In conclusion, we can never really pick the single best messaging protocol for all use cases. Each of them has its own unique set of pros and cons. You will have to carefully go through its features and decide what’s best for you. However, in my opinion MQTT and DDS are 2 of the best available messaging protocols. MQTT is the most used in the industry at the moment and hence has a lot of support. However DDS is known for its speed and security which is useful most often.

This article is my attempt at making the decision making process simpler. I hope this article helped you choose the right protocol for your project.

Creating a multiplication Skill in Alexa using python

Written By Sashreek Shankar

Hey reader! I am Sashreek, a 16 year old programmer who loves Robotics, IoT and Open Source. I am extremely enthusiastic about the Raspberry Pi and Arduino hardware as well. I also believe in sharing any knowledge I have so feel free to ask me anything 🙂

RELATED POSTS

How to use MQTTBox to debug MQTT messages?

How to use MQTTBox to debug MQTT messages?

MQTTBox is a versatile MQTT (Message Queuing Telemetry Transport) client tool that facilitates testing and debugging of MQTT-based applications. MQTT is a lightweight messaging protocol commonly used in IoT (Internet of Things) and other scenarios where low-bandwidth,...

How to enable Mosquitto MQTT over WebSocket on Windows

How to enable Mosquitto MQTT over WebSocket on Windows

WebSocket is one of the communication protocols which provides full duplex communication over a single TCP/IP connection. It uses HTTP as a intial connection establishment. The WebSocket enables the communication from the web browser (client) to the server, in which...

MQTT Mosquitto Broker on Windows via Windows PowerShell

MQTT Mosquitto Broker on Windows via Windows PowerShell

Eclipse Mosquitto is an open-source message broker (EPL/EDL licensed) that supports MQTT versions 5.0, 3.1.1, and 3.1. The MQTT protocol uses a publish/subscribe method to deliver a lightweight messaging method. This makes it outstanding for Internet of Things (IoT)...

How to Install the Mosquitto MQTT Broker on Linux (Ubuntu)?

How to Install the Mosquitto MQTT Broker on Linux (Ubuntu)?

With IoT becoming a leading name in the market, businesses are keen to import it in their strategy. Due to the increasing demand, many people seek to learn the use of Mosquitto MQTT broker Linux to pump up their IoT productivity. Eclipse Mosquitto is an open-source...

How to build an MQTT Server using Raspberry Pi

installing-and-testing-MQTT-on-Raspberry_Pi What is MQTT ? MQTT stands for Message Queuing Telemetry Transport and is a network messaging protocol commonly used for messaging between IoT devices. MQTT is a publish/subscribe protocol that allows edge-of-network devices...

CoAP and MQTT: Analyzing the Best IoT Protocol

CoAP and MQTT: Analyzing the Best IoT Protocol

INTRODUCTION TO CoAP and MQTT CoAP and MQTT are two of the most important and most used IoT protocols nowadays. Both are equally important in machine communication. CoAP is a considerable competitor for MQTT because of the similarities in their use. Yet both have...

Mosquitto MQTT Broker introduction

Mosquitto MQTT Broker introduction

In this tutorial, we will discuss about the intro of Mosquittto MQTT broker. MQTT Broker is responsible for receiving network connections from the client and handling the client’s requests of Subscribe/Unsubscribe and Publish, as well as forwarding the messages...

How to Install the Mosquitto MQTT Broker on Windows?

How to Install the Mosquitto MQTT Broker on Windows?

The Mosquitto or MQTT broker is an OASIS standard messaging protocol for IoT. The inculcation of IoT in modern-day lives has pulled MQTT in the picture. Being a lightweight messaging transport that can remotely connect devices, MQTT tutorials were in much demand. So,...

How to choose an MQTT broker for an IoT project?

How to choose an MQTT broker for an IoT project?

What is MQTT Broker? MQTT stands for Message Queuing Telemetry Transport is an open OASIS and ISO standard lightweight, a publish-subscribe network protocol that transports messages between devices. Basically, MQTT Broker is simply software running on the computer. It...

VIDEOS – FOLLOW US ON YOUTUBE

EXPLORE OUR IOT PROJECTS

IoT Smart Gardening System – ESP8266, MQTT, Adafruit IO

Gardening is always a very calming pastime. However, our gardens' plants may not always receive the care they require due to our active lifestyles. What if we could remotely keep an eye on their health and provide them with the attention they require? In this article,...

How to Simulate IoT projects using Cisco Packet Tracer

In this tutorial, let's learn how to simulate the IoT project using the Cisco packet tracer. As an example, we shall build a simple Home Automation project to control and monitor devices. Introduction Firstly, let's quickly look at the overview of the software. Packet...

All you need to know about integrating NodeMCU with Ubidots over MQTT

In this tutorial, let's discuss Integrating NodeMCU and Ubidots IoT platform. As an illustration, we shall interface the DHT11 sensor to monitor temperature and Humidity. Additionally, an led bulb is controlled using the dashboard. Besides, the implementation will be...

All you need to know about integrating NodeMCU with Ubidots over Https

In this tutorial, let's discuss Integrating NodeMCU and Ubidots IoT platform. As an illustration, we shall interface the DHT11 sensor to monitor temperature and Humidity. Additionally, an led bulb is controlled using the dashboard. Besides, the implementation will be...

How to design a Wireless Blind Stick using nRF24L01 Module?

Introduction Let's learn to design a low-cost wireless blind stick using the nRF24L01 transceiver module. So the complete project is divided into the transmitter part and receiver part. Thus, the Transmitter part consists of an Arduino Nano microcontroller, ultrasonic...

Sending Temperature data to ThingSpeak Cloud and Visualize

In this article, we are going to learn “How to send temperature data to ThingSpeak Cloud?”. We can then visualize the temperature data uploaded to ThingSpeak Cloud anywhere in the world. But "What is ThingSpeak?” ThingSpeak is an open-source IoT platform that allows...

Amaze your friend with latest tricks of Raspberry Pi and Firebase

Introduction to our Raspberry Pi and Firebase trick Let me introduce you to the latest trick of Raspberry Pi and Firebase we'll be using to fool them. It begins with a small circuit to connect a temperature sensor and an Infrared sensor with Raspberry Pi. The circuit...

How to implement Machine Learning on IoT based Data?

Introduction The industrial scope for the convergence of the Internet of Things(IoT) and Machine learning(ML) is wide and informative. IoT renders an enormous amount of data from various sensors. On the other hand, ML opens up insight hidden in the acquired data....

Smart Display Board based on IoT and Google Firebase

Introduction In this tutorial, we are going to build a Smart Display Board based on IoT and Google Firebase by using NodeMCU8266 (or you can even use NodeMCU32) and LCD. Generally, in shops, hotels, offices, railway stations, notice/ display boards are used. They are...

Smart Gardening System – GO GREEN Project

Automation of farm activities can transform agricultural domain from being manual into a dynamic field to yield higher production with less human intervention. The project Green is developed to manage farms using modern information and communication technologies....