IoT Protocols: Comparing MQTT, CoAP, and HTTP for Efficient Device Communication

By: Simran Jaggi, CSE Department, Chandigarh College of Engineering and Technology, Chandigarh, India

Abstract:

The Internet of Things has brought about a revolutionary change in the way devices communicate and exchange information. With an exponential increase in the number of connected devices, the demand for efficient and reliable communication protocols has become absolutely crucial. This article focuses on the domain of IoT protocols and comparison of MQTT, CoAP and HTTP. By thoroughly determining their features, performance for efficient device communication, this article aims to assist in selecting the most suitable protocol for specific IoT applications such as healthcare industries, Industrial IoTs, Smart Cities, logistics and supply chain, agriculture, for the community at large.

Keywords: IoT Systems, MQTT, CoAP, HTTP, Communication Protocols, Quality of Services.

1. Introduction

The emergence of IoT applications has given rise to many communication demands, encompassing devices with low-power capabilities and limited resources, as well as those requiring high-throughput and reliable connections [1]. The swift proliferation of Internet of Things (IoT) devices has developed the necessity for efficient communication protocols that facilitate seamless data exchange between these devices[2]. The rapid growth of IoT devices has compelled the development of communication protocols capable of accommodating the diverse requirements of various applications. The term “IoT protocols” refers to the communication protocols and standards that enable devices and systems in the Internet of Things (IoT) to exchange data. There are several IoT protocols as shown in Figure 1, each designed for specific use cases and requirements. This section introduces the three key protocols under scrutiny – MQTT, CoAP, and HTTP – providing an overview of their fundamental principles and emphasizing their importance in the IoT landscape.

1.1 IoT Technology

Internet of Things (IoT) surrounds a network of interconnected physical devices with sensors and actuators, facilitating constant data exchange [3], [4]. Adherence to established protocols is crucial for the reliable communication of these devices, particularly in challenging environments where continuous human intervention is impractical and bandwidth is limited. IoT’s transformative impact extends across industries, revolutionizing logistics through applications like intelligent transportation, smart traffic monitoring, and efficient supply chain tracking [5], [6], [7]. The advent of IoT has significantly contributed to sustainable [8] corporate growth and accelerated software development by fostering interconnected ecosystems, optimizing operational processes, and unlocking new opportunities for innovation [9]. With over 50 billion projected IoT devices globally, the exponential growth is fueled by smart systems employing wireless technologies and integrated sensors, which generates vast amounts of data for effective processing, storage, and user-friendly presentation [10-12].

Figure 1. Types of IoT Protocols

The various IoT protocol layers are:

1. Physical and Link Layers: Manages the actual transmission of data, addressing the hardware and connectivity aspects, including the physical medium and data link control.

2. Network Layer: Handles routing and addressing, ensuring efficient data transfer between IoT devices across different networks.

3. Transport Layer: Ensures reliable and orderly data delivery between devices. Manages error detection and correction, as well as flow control to optimize data transmission.

4. Application Layer: Manages end-user services and data interaction, defining how IoT devices communicate and share information at the highest level.

The diagrammatic representation of the various IoT protocol layers are as shown in Figure 2.


Figure 2. IoT Protocol Layers

1.2 MQTT

MQTT, a protocol based on publish-subscribe and known for its lightweight nature, is particularly effective in scenarios where low bandwidth and high latency are crucial factors. Its minimal overhead and support for different Quality of Service levels make it well-suited for applications with intermittent connections. In the following section, we will explore MQTT’s architecture, message format, and the important role that brokers play in managing communication [13].

Key features of MQTT for efficient device communication include:

A. Publish-Subscribe Architecture as shown in Figure 3: states that messaging pattern is such that the devices can act as either publishers or subscribers. In the process, publishers send messages to a central broker which distributes the messages to all devices.

Figure 3. MQTT Architecture

B. Asynchronous Communication: enables the devices to transmit and receive messages without establishment of a persistent connection. It plays a significant role in devices with intermittent connectivity and work on low power modes to conserve energy.

C. Quality of Service (QoS) Levels: QoS levels uses MQTT to provide assurance of different levels of message delivery. QoS 0 ensures that without any confirmation the message is delivered at most once, QoS 1 ensures that the sender receives the acknowledgement of message delivery and the message is delivered at least once and QoS 2 ensures that the message is delivered exactly once using a four-step handshake mechanism [14].

D. Lightweight Protocol[15]: It is designed to be lightweight in terms of both protocol overhead and data payload. It is suitable in cases where there is limited bandwidth and resources.

E. Scalability: It becomes highly scalable, expanding the connection of devices to a central broker. And the broker ensures efficient communication of data to the appropriate subscribers.

1.3 CoAP

CoAP, known as the Constrained Application Protocol, is a communication protocol designed to facilitate efficient and lightweight interaction among devices in the realm of the Internet of Things (IoT)[16], [17]. Its aim is to work efficiently in environments where devices may have constraints in terms of processing power, memory capacity, and energy resources. It follows the client-server architecture [18] where constrained devices make requests to servers, enabling efficient communication over the Internet of Things (IoT) with a focus on resource-constrained environments as shown in Figure 4. This protocol operates on a request-response model and follows the principles of Representational State Transfer (REST), making it highly suitable for devices that have resource constraints.

Figure 4: – CoAP Architecture

Key features of CoAP for efficient device communication include:

a. RESTful Design: this RESTful design approach makes CoAP easy to understand and integrate with existing web technologies. CoAP follows a Representational State Transfer (REST) framework [19], [20], resembling HTTP. It utilizes a straightforward model of request and response, enabling devices to communicate using conventional HTTP methods like GET, POST, PUT, and DELETE.

b. UDP Transport: CoAP functions on the User Datagram Protocol (UDP), a transport protocol known for its lightweight nature. Unlike HTTP, which predominantly relies on TCP, UDP diminishes the overhead involved in establishing and sustaining connections. The utilization of UDP enables CoAP to be well-suited for scenarios where low-latency communication is crucial.

c. Scalability: CoAP is designed to scale efficiently from small, resource-constrained devices to more powerful servers. It is versatile for different IoT applications as it can accommodate a variety of device types and communication patterns.

d. Reliability Mechanisms: CoAP provides optional reliability through the use of Confirmable (CON) messages. It includes mechanisms for message acknowledgment and retransmission, enhancing reliability over lossy networks.

e. UDP Transport: CoAP functions on the User Datagram Protocol (UDP), a transport protocol known for its lightweight nature. Unlike HTTP, which predominantly relies on TCP, UDP diminishes the overhead involved in establishing and sustaining connections. The utilization of UDP enables CoAP to be well-suited for scenarios where low-latency communication is crucial.

f. Proxy and Caching: CoAP allows for the use of proxy servers, enabling the optimization of communication paths and providing caching mechanisms. This can improve the overall efficiency of communication and reduce the load on constrained devices.

1.4 HTTP

The HTTP protocol, which is widely recognized and extensively utilized, is renowned for its simplicity and adaptability [21]. The compatibility of HTTP with IoT applications and its effectiveness in managing substantial volumes of data, along with seamless integration with existing web technologies makes it a versatile protocol. The HTTP (Hypertext Transfer Protocol) architecture follows a client-server model, where clients (e.g., web browsers) send requests to servers, and servers respond with the requested data, facilitating the exchange of information on the World Wide Web as shown in Figure 5.

Figure 5. HTTP Architecture

Key features of HTTP for efficient device communication include:

i. Standardization and Ubiquity: HTTP is a standardized protocol, its ubiquity allows for seamless integration with existing web technologies, making it accessible for a broad range of IoT applications.

ii. Simplicity: HTTP’s simplicity makes it easy to implement and work with, which is beneficial for developers and devices with limited resources.

iii. Compatibility with Web Technologies: HTTP utilizes familiar and compatible web technologies. Thus the integration of HTTP with web servers and services is made simple and efficient.

iv. Versatility: HTTP supports various data formats, including JSON and XML, making it suitable for diverse IoT data exchange requirements.

v. Caching Mechanism: The utilization of the built-in caching mechanism in HTTP can prove to be advantageous for IoT applications, as it allows for the optimization of repeated requests for the same data.

2. Performance Comparison

The performance comparison of MQTT, CoAP, and HTTP on the parameters such as message frequency, message size, bits per second, and effective device communication are shown below in Table 1 for clear understanding of each protocol’s strengths and weaknesses [22].

Table 1. Comparison of MQTT, CoAP, HTTP

Protocol

Message Frequency

Message Size

Bits per Second

Effective Device Communication

MQTT

Variable, Low

Small

Moderate to High

Efficient, Low Overhead

CoAP

Variable, Moderate

Small to Medium

Moderate to High

Efficient, Designed for IoT

HTTP

Variable, High

Medium to Large

High

Common, Higher Overhead

3. Conclusion

The conclusion describes the rapid expansion of IoT devices has necessitated efficient communication protocols. It provides the necessary details of HTTP, widely recognized and simple and offers versatility and compatibility with existing web technologies. MQTT, with its lightweight nature and publish-subscribe architecture, excels in low-bandwidth scenarios. CoAP, designed for resource-constrained devices, adopts a RESTful design and UDP transport for scalability and low-latency communication. In context to IoT communication, the performance table indicates that each protocol has strengths and weaknesses based on parameters like message frequency and size. The choice of protocol should align with specific IoT application requirements, considering factors such as bandwidth, device constraints, and data exchange needs. It provides information for selecting the most suitable protocol based on specific key features such as simplicity, scalability, reliability, network quality, architecture and device constraints. This research article aims to contribute to the ongoing discourse surrounding IoT protocols, aiding developers, engineers, and decision-makers in making informed choices for efficient and reliable device communication in diverse IoT ecosystems.

4. References

  1. Vats, T., Singh, S. K., Kumar, S., Gupta, B. B., Gill, S. S., Arya, V., & Alhalabi, W. (2023). Explainable context-aware IoT framework using human digital twin for healthcare. Multimedia Tools and Applications, 1-25. Doi: http://dx.doi.org/10.1007/s11042-023-16922-5
  2. Kumar, R., Singh, S. K., & Lobiyal, D. K. (2023). UPSRVNet: Ultralightweight, Privacy preserved, and Secure RFID-based authentication protocol for VIoT Networks. The Journal of Supercomputing, 1-28.
  3. Gupta, A., Singh, S. K., & Chopra, M. (2023). Impact of Artificial Intelligence and the Internet of Things in Modern Times and Hereafter: An Investigative Analysis. In Advanced Computer Science Applications (pp. 157-173). Apple Academic Press.
  4. Kumar, R., Sinngh, S. K., & Lobiyal, D. K. (2023, April). Routing of Vehicular IoT Networks based on various routing Metrics, Characteristics, and Properties. In 2023 International Conference on Computational Intelligence, Communication Technology and Networking (CICTN) (pp. 656-662). IEEE.
  5. Kumar, R., Singh, S. K., & Lobiyal, D. K. (2023). Communication structure for Vehicular Internet of Things (VIoTs) and review for vehicular networks. In Automation and Computation (pp. 300-310). CRC Press.
  6. Kumar, R., Sinngh, S. K., & Lobiyal, D. K. (2023, April). Routing of Vehicular IoT Networks based on various routing Metrics, Characteristics, and Properties. In 2023 International Conference on Computational Intelligence, Communication Technology and Networking (CICTN) (pp. 656-662). IEEE.
  7. Chopra, M., Kumar, S., Madan, U., & Sharma, S. (2021, December). Influence and establishment of smart transport in smart cities. In International Conference on Smart Systems and Advanced Computing (Syscom-2021).
  8. Peñalvo, F. J. G., Sharma, A., Chhabra, A., Singh, S. K., Kumar, S., Arya, V., & Gaurav, A. (2022). Mobile cloud computing and sustainable development: Opportunities, challenges, and future directions. International Journal of Cloud Applications and Computing (IJCAC), 12(1), 1-20.
  9. SINGH, S., KARTIK, J. A. S. G., & KUMAR, S. The Role of Site Reliability Engineering in Sustainable Development. space, 2(10), 11.
  10. Naik, N. (2017, October). Choice of effective messaging protocols for IoT systems: MQTT, CoAP, AMQP and HTTP. In 2017 IEEE international systems engineering symposium (ISSE) (pp. 1-7). IEEE.
  11. Saini, T., Kumar, S., Vats, T., & Singh, M. (2020). Edge Computing in Cloud Computing Environment: Opportunities and Challenges. In International Conference on Smart Systems and Advanced Computing (Syscom-2021).
  12. Singh, R., Singh, S. K., Kumar, S., & Gill, S. S. (2022). SDN-Aided Edge Computing-Enabled AI for IoT and Smart Cities. SDN-Supported Edge-Cloud Interplay for Next Generation Internet of Things, 41-70.
  13. Naik, N. (2017, October). Choice of effective messaging protocols for IoT systems: MQTT, CoAP, AMQP and HTTP. In 2017 IEEE international systems engineering symposium (ISSE) (pp. 1-7). IEEE.
  14. Hemat, E. (2023). Study and Comparison of Low Bandwidth IoT Protocols.
  15. Pegah Nikbakht Bideh, Jonathan Sönnerup, and Martin Hell. 2020. Energy consumption for securing lightweight IoT protocols. In Proceedings of the 10th International Conference on the Internet of Things (IoT ’20). Association for Computing Machinery, New York, NY, USA, Article 16, 1–8. https://doi.org/10.1145/3410992.3411008
  16. Usmani, M. F. MQTT Protocol for the IoT.
  17. Khanam, S., Tanweer, S., & Khalid, S. S. (2022). Future of Internet of Things: Enhancing Cloud-Based IoT Using Artificial Intelligence. International Journal of Cloud Applications and Computing (IJCAC), 12(1), 1-23. http://doi.org/10.4018/IJCAC.297094
  18. Kumar, S., Singh, S. K., Aggarwal, N., Gupta, B. B., Alhalabi, W., & Band, S. S. (2022). An efficient hardware supported and parallelization architecture for intelligent systems to overcome speculative overheads. International Journal of Intelligent Systems, 37(12), 11764-11790.
  19. Peñalvo, F. J. G., Maan, T., Singh, S. K., Kumar, S., Arya, V., Chui, K. T., & Singh, G. P. (2022). Sustainable Stock Market Prediction Framework Using Machine Learning Models. International Journal of Software Science and Computational Intelligence (IJSSCI), 14(1), 1-15.
  20. Kumar, S., Singh, S. K., & Aggarwal, N. (2023, September). Sustainable Data Dependency Resolution Architectural Framework to Achieve Energy Efficiency Using Speculative Parallelization. In 2023 3rd International Conference on Innovative Sustainable Computational Technologies (CISCT) (pp. 1-6). IEEE.
  21. Jara Ochoa, H. J., Peña, R., Ledo Mezquita, Y., Gonzalez, E., & Camacho-Leon, S. (2023). Comparative Analysis of Power Consumption between MQTT and HTTP Protocols in an IoT Platform Designed and Implemented for Remote Real-Time Monitoring of Long-Term Cold Chain Transport Operations. Sensors, 23(10), 4896.
  22. Sidna, J., Amine, B., Abdallah, N., & El Alami, H. (2020, September). Analysis and evaluation of communication protocols for IoT applications. In Proceedings of the 13th international conference on intelligent systems: theories and applications (pp. 1-6).

Cite As

Jaggi S (2024) IoT Protocols: Comparing MQTT, CoAP, and HTTP for Efficient Device Communication, Insights2Techinfo, pp. 1

66540cookie-checkIoT Protocols: Comparing MQTT, CoAP, and HTTP for Efficient Device Communication
Share this:

Leave a Reply

Your email address will not be published.