How to Choose the Right IoT Communication Protocol: MQTT, CoAP, AMQP, REST/HTTP, JMS, XMPP & DDS

How to Choose the Right IoT Communication Protocol: MQTT, CoAP, AMQP, REST/HTTP, JMS, XMPP & DDS

Recently, we have been discussing the MQTT IoT communication protocol. However, in reality, there are more than just MQTT in the realm of IoT communication protocols. In the field of Industrial IoT (IIoT), OPC UA and MQTT are more commonly involved and applied. Therefore, in this article, we will briefly introduce several other IoT protocols to better utilize them.

Communication protocols are a crucial component of data communication in IoT applications. However, choosing a communication protocol can be challenging as it depends on the nature of the IoT system and its data transmission requirements. Over the past decade, researchers have developed and utilized a multitude of communication protocols based on their needs. Nevertheless, no single protocol can meet all standard requirements, such as energy efficiency, security, and quality of service. In all types of IoT systems, communication protocols remain a persistent challenge in the IoT industry; thus, it is essential to analyze the behavior and mechanisms of these protocols to determine their optimal application scenarios.

How to Choose the Right IoT Communication Protocol: MQTT, CoAP, AMQP, REST/HTTP, JMS, XMPP & DDS

This article evaluates the performance of established communication protocols such as HTTP, MQTT, DDS, XMPP, AMQP, and CoAP in IoT applications. First, it provides a comprehensive comparison of these communication protocols to introduce their features. Subsequently, it conducts a detailed and in-depth analysis of the processes related to understanding their advantages and limitations. Finally, based on this detailed assessment, users can determine the appropriate usage of various IoT applications based on their needs, efficiency, and applicability.

How to Choose the Right IoT Communication Protocol: MQTT, CoAP, AMQP, REST/HTTP, JMS, XMPP & DDS

IoT Communication Protocols

IoT Communication Protocols

IoT protocols are standards or “languages” for communication between machines or between machines and platforms, responsible for handling and coordinating communication between IoT devices. IoT protocols can be categorized into different types based on their characteristics and functions, primarily including access protocols and communication protocols. We can detail the different levels of protocols through the OSI model, as shown in the figure below:How to Choose the Right IoT Communication Protocol: MQTT, CoAP, AMQP, REST/HTTP, JMS, XMPP & DDSThe topmost layers are layers 5-7 (Session Layer, Presentation Layer, and Application Layer), which are used for data processing. Technologies we encounter in daily life, such as Bluetooth, Wi-Fi, and 5G, belong to the lower layers, which are used for transmission. The application layer, as the final layer, is the only level that interacts with the end user. In fact, the protocols we are discussing this time are application layer protocols.How to Choose the Right IoT Communication Protocol: MQTT, CoAP, AMQP, REST/HTTP, JMS, XMPP & DDSThe above figure illustrates a typical IoT system architecture, where MQTT is just one of the communication protocols. Applications utilizing IoT technology consist of three key components:

  1. IoT devices used in the application
  2. The IoT communication protocol that operates at the application layer to provide internet (cloud) connectivity
  3. Systems (distributed databases and cloud systems) used to store and process big data from IoT devices, as well as cloud platforms for monitoring, analyzing, and managing IoT applications.

How to Choose the Right IoT Communication Protocol: MQTT, CoAP, AMQP, REST/HTTP, JMS, XMPP & DDS

Seven Communication Protocols

1.REST/HTTP

REST (Representational State Transfer) is an architectural style rather than a standard for designing web applications, typically using HTTP as its transport protocol to implement its architectural principles.

How to Choose the Right IoT Communication Protocol: MQTT, CoAP, AMQP, REST/HTTP, JMS, XMPP & DDS

Features:

  • Stateless: Each request contains all the necessary information, and the server does not maintain the client’s state.

  • Resource Identification: On the server side, application states and functionalities can be divided into various resources and exposed to the client. For example, resources include application objects, database records, algorithms, etc. Each resource is assigned a unique address via a URI (Uniform Resource Identifier).

  • Uniform Interface: Uses standard HTTP methods to manipulate resources, such as GET, POST, PUT, DELETE.

Applications:

REST/HTTP is primarily designed to simplify the system architecture of the internet, enabling loose coupling for rapid client-server interaction, thereby reducing interaction latency. Therefore, it is suitable for IoT applications, exposing IoT resources through REST, allowing services to be invoked by other applications.

2.CoAP

CoAP (Constrained Application Protocol) provides simple and efficient communication for constrained devices, making it very suitable for operation in low-power, low-bandwidth, and high-latency environments.

How to Choose the Right IoT Communication Protocol: MQTT, CoAP, AMQP, REST/HTTP, JMS, XMPP & DDS

Features:

  • Header Compression: CoAP has a compact binary header, based on 4 bytes, followed by extended options, with typical request headers being 10-20 bytes.

  • Methods and URIs: Supports GET, PUT, POST, DELETE methods and URIs for accessing server resources.

  • Transport Layer: Built on UDP, minimizing overhead and supporting multicast, with a simple stop-and-wait reliability mechanism.

  • Asynchronous Communication: Unlike HTTP, CoAP supports asynchronous communication, making it very suitable for M2M (Machine to Machine) applications.

  • Resource Discovery: Includes a built-in resource discovery format compliant with RFC 5785, using /.well-known/core for resource description.

  • Cache: Supports caching of resource descriptions to improve performance.

Applications:

CoAP is a simplified version of a RESTful API based on HTTP. CoAP is the application layer protocol in the 6LoWPAN protocol stack, suitable for resource-constrained communication IP networks, such as low-power sensors and embedded systems.

3.MQTT

The MQTT protocol adopts a publish/subscribe model, where IoT terminals typically connect to an MQTT broker via TCP. The broker manages communication content through topics and is responsible for forwarding messages between devices.

How to Choose the Right IoT Communication Protocol: MQTT, CoAP, AMQP, REST/HTTP, JMS, XMPP & DDS

Features:

  • Publish/Subscribe Model: Clients can publish messages to topics and subscribe to receive messages from specific topics. This model enables flexible message distribution.

  • Low Bandwidth: Message headers are extremely small, typically only 2 bytes, supporting efficient bandwidth usage, making it suitable for low-bandwidth, high-latency, and unstable networks.

  • Reliability: MQTT provides three levels of Quality of Service (QoS) for message delivery: “At most once,” “At least once,” and “Exactly once.”

Applications:

MQTT is typically suitable for device data collection to terminals (e.g., device->server) and centralized communication in star network architectures, with the broker serving as the central hub. It is widely used in IoT scenarios and has also been adopted by some mobile applications, such as Facebook Messenger (historically).

4.DDS

DDS (Data Distribution Service) is a middleware standard created for real-time systems. It meets the stringent requirements of distributed applications by providing low latency, high throughput, and deterministic performance.

How to Choose the Right IoT Communication Protocol: MQTT, CoAP, AMQP, REST/HTTP, JMS, XMPP & DDS

Features:

  • Data-Centric:

  • No Broker Publish/Subscribe Messaging Model: Supports point-to-point, point-to-multipoint, and multipoint-to-multipoint communication.

  • Offers up to 21 Quality of Service (QoS) policies:

Applications:

Suitable for distributed, high-reliability, real-time data communication for devices. Currently, DDS is widely used in civil aviation and industrial control fields.

5.AMQP

AMQP is an open standard application layer protocol designed to ensure reliable messaging and queuing mechanisms.

How to Choose the Right IoT Communication Protocol: MQTT, CoAP, AMQP, REST/HTTP, JMS, XMPP & DDS

Features:

  • Cable-Level Protocol: Transmits data as a byte stream over the network.

  • Highly Compatible Due to Open Standards:

  • Flexible and Secure: Supports various messaging patterns, including publish/subscribe and point-to-point. It also incorporates multiple security mechanisms, such as encryption and authentication.

Applications:

Initially used for transaction messaging in financial systems, AMQP is now primarily used for IoT application communication and data analysis between mobile devices and backend data centers.

6.XMPP

As an open communication protocol, XMPP (Extensible Messaging and Presence Protocol) is designed for real-time communication, such as instant messaging and online presence information.

How to Choose the Right IoT Communication Protocol: MQTT, CoAP, AMQP, REST/HTTP, JMS, XMPP & DDS

Features:

  • Client/Server Communication Model: Clients send requests to the server, which processes the requests and sends appropriate responses or resources back to the clients.

  • Distributed Network: Composed of multiple independent nodes, eliminating single points of failure.

  • Simple Client: Clients handle fewer tasks, with most computations performed on the server side.

  • Uses XML to Describe Data, Ensuring Cross-Platform Compatibility, Although JSON Has Become More Popular in Modern Applications:

Applications:

XMPP is used for instant messaging, network management, content distribution, collaboration tools, file sharing, gaming, remote system monitoring, and more.

7.JMS

JMS (Java Message Service) is a distributed application messaging standard API for the Java platform. It allows applications to communicate via message queues, enabling asynchronous, flexible, and reliable message exchange.

How to Choose the Right IoT Communication Protocol: MQTT, CoAP, AMQP, REST/HTTP, JMS, XMPP & DDS

Features:

  • Asynchronous Communication: Allows messages to be sent and received at different times, increasing system flexibility and responsiveness.

  • Message Persistence: Provides message persistence to ensure that messages are not lost during system failures, enhancing reliability.

  • Transaction Support: JMS provides transaction support, ensuring the atomicity of a group of message operations, meaning all operations either succeed completely or fail completely, thus ensuring data consistency.

Applications:

JMS is suitable for distributed applications requiring asynchronous messaging, system decoupling, and high reliability, such as enterprise application integration, event-driven architectures, and real-time data processing.

How to Choose the Right IoT Communication Protocol: MQTT, CoAP, AMQP, REST/HTTP, JMS, XMPP & DDS

Comparison of IoT Protocols

We provide a detailed comparison in the table below:How to Choose the Right IoT Communication Protocol: MQTT, CoAP, AMQP, REST/HTTP, JMS, XMPP & DDS

Of course, different literature presents different introductions, but generally, commonly used IoT protocols such as MQTT, CoAP, AMQP, etc., are included, and others not detailed can be referenced in the links at the end.

How to Choose the Right IoT Communication Protocol: MQTT, CoAP, AMQP, REST/HTTP, JMS, XMPP & DDS

Conclusion

When designing a specific IoT system architecture, it is essential to consider the following practical communication requirements before selecting the most suitable communication protocol:

  • Transmission Rate and Bandwidth Requirements: Different IoT applications have varying needs for transmission rates and bandwidth. For example, real-time video monitoring requires a higher transmission rate and bandwidth, while simple sensor data transmission has lower requirements.
  • Latency Requirements: Certain applications (such as autonomous driving) are very sensitive to network latency and require low-latency communication protocols. In contrast, some non-real-time applications can tolerate higher latency.
  • Reliability: Some applications (such as industrial control) require highly reliable communication to ensure accurate data transmission.
  • Device Compatibility: The chosen protocol needs to be compatible with existing devices and technologies to ensure system scalability and maintainability.
  • Security: In applications involving sensitive data transmission, the protocol needs to provide adequate security measures, such as encryption and authentication mechanisms.
  • Cost-Effectiveness: Considering deployment and maintenance costs, choosing a cost-effective protocol can reduce the overall ownership cost.

Reference Links:

  1. https://www.minew.com/iot-communication-protocols/

  2. https://dzone.com/articles/which-are-the-iot-messaging-protocols

  3. https://pmc.ncbi.nlm.nih.gov/articles/PMC8540579/

  4. https://www.nexpcb.com/blog/different-data-protocols-which-one-to-choose

  5. https://webbylab.com/blog/mqtt-vs-other-iot-messaging-protocols/

  6. https://lab.wallarm.com/what/mqtt-vs-amqp/

  7. https://insights2techinfo.com/iot-protocols-comparing-mqtt-coap-and-http-for-efficient-device-communication/

How to Choose the Right IoT Communication Protocol: MQTT, CoAP, AMQP, REST/HTTP, JMS, XMPP & DDS

  • [Video Course] Codesys V3.5 Series Introduction Course(141 people have learned)
  • [Video Course] Codesys SoftMotion Basic Course(42 people have learned)
  • [Video Course] Codesys SoftMotion Electronic Gear Course(15 people have learned)
  • [Video Course] Codesys SoftMotion Electronic Cam Course(10 people have learned)
  • [Video Course] Making Custom Libraries in Codesys(23 people have learned)
  • Comprehensive Free Resources for Codesys V3.5 Series

  • Top Ten Common Filtering Algorithms (ST Language)

  • What Does a PLC Integrated with Chat GPT Look Like?

  • Sharing the Top 10 PLC Programming Books of 2023

  • Customize Your Own CODESYS Motion Controller

  • Can MC_Power.status = FALSE, and the axis still move?

  • Summary of ST Language Learning Materials

How to Choose the Right IoT Communication Protocol: MQTT, CoAP, AMQP, REST/HTTP, JMS, XMPP & DDS

——–END——–

How to Choose the Right IoT Communication Protocol: MQTT, CoAP, AMQP, REST/HTTP, JMS, XMPP & DDSIf you like this article, please share and “like” it How to Choose the Right IoT Communication Protocol: MQTT, CoAP, AMQP, REST/HTTP, JMS, XMPP & DDS and “look at it How to Choose the Right IoT Communication Protocol: MQTT, CoAP, AMQP, REST/HTTP, JMS, XMPP & DDS

Leave a Comment