IoT devices use different communication and messaging protocols at different layers. When developing IoT devices, the type, layers, and functions the device is intended to perform often determine the final choice. MQTT, XMPP, DDS, AMQP, and CoAP are some of the communication protocols widely used in the IoT application layer. Today, this article will take you through the advantages and disadvantages of these communication protocols.
MQTT
MQTT is a machine-to-machine (M2M) protocol. It is a publish-subscribe based messaging protocol for transferring device data to the server. The main purpose of MQTT is to remotely manage IoT devices. It is mainly used for large networks of small devices that need to be monitored or managed over the Internet, i.e. parking sensors, underwater lines, energy networks, etc.
How MQTT works
advantage:
▪ Lightweight for restricted networks
▪ Flexible selection of quality of service with given features
▪ Standardized by the OASIS Technical Committee
▪ Simple and fast to implement
shortcoming:
▪ High power consumption due to TCP based connection
▪ Lack of encryption
Common application scenarios:
Many parking sensors are installed in large underground parking lots to identify the number and location of empty or vacant parking spaces.
XMPP
XMPP uses XML format for messaging. The main feature of this protocol is its addressing mechanism. It uses an address called Jabber ID (JID) to identify devices/nodes in the IoT network. JID follows the standard – name@domain.com. This addressing mechanism enables two nodes to exchange information regardless of their distance in the network.
XMPP messages are typically transmitted over the underlying TCP connection. It uses a polling mechanism to identify the destination of the message. XMPP is implemented using a client-server architecture. The client starts the XML stream by sending a start tag. The server then replies to the client using the XML stream. Since XMPP is an open protocol, anyone can have their own XMPP server in their network without being connected to the Internet.
How XMPP works
advantage:
▪ Addressing scheme to identify devices on the network
▪ Client – server architecture
shortcoming:
▪ Text-based messaging, no end-to-end encryption configured
▪ No service quality regulations
Common application scenarios:
A smart thermostat that can be accessed from a smartphone via a web server; a gaming console that provides instant messaging between two online players.
DDS
DDS is also based on a publish-subscribe model. DDS connects devices directly, unlike MQTT, which connects them to servers. This is why DDS is faster than MQTT. Apparently it can deliver millions of messages to multiple different receivers in seconds because it eliminates communication with the server. DDS can be used to provide device-to-device communication over a data bus. It provides detailed service quality and reliability.
How DDS works
advantage:
▪ Based on a simple publish-subscribe communication paradigm
▪ Flexible and adaptable architecture that supports “auto-discovery” of new or outdated endpoint applications
▪ Low overhead – can be used with high performance systems
▪ Deterministic data delivery
▪ Dynamically scalable
▪ Efficient use of transmission bandwidth
Common application scenarios:
Military systems, wind farms, hospital integration, medical imaging, asset tracking systems, and automotive testing and safety.
AMQP
Advanced Message Queuing Protocol (AMQP) is an open standard application layer protocol used to send transaction messages between servers. As a message-centric middleware, it can handle thousands of queued transactions reliably. AMQP focuses on not losing messages because messages can be transported using TCP or UDP. The use of TCP provides reliable point-to-point connections. Additionally, the endpoint must confirm acceptance of each message. The standard also describes an optional transaction mode with a formal multi-phase commit sequence. AMQP focuses on tracking messages and ensuring that each message is delivered as expected, regardless of failures or restarts.
How AMQP works
advantage:
▪ Messages can be sent via TCP and UDP
▪ Provides end-to-end encryption
shortcoming:
▪ Relatively high resource utilization, i.e. power and memory usage
Common application scenarios:
AMQP is mainly used for business messaging. It typically defines devices such as mobile phones that communicate with backend data centers.
Summarize
All the protocols listed above are particularly suitable for different operating scenarios. Any protocol can be carefully chosen based on its pros and cons for IoT application development. The main factors to consider while choosing any of them for your application are the quality of service, security, and the reliability required by the application.
Any protocol can be carefully chosen based on its pros and cons for IoT application development. The main factors we need to consider when choosing a transport protocol for an application are quality of service, security, and the reliability required by the application.