Which Are the IoT Messaging Protocols?
Which Are the IoT Messaging Protocols?
Want to learn more about the top platforms for IoT messaging protocols? Check out this post where we look at the different types of messaging protocols for your app.
Join the DZone community and get the full member experience.Join For Free
Digi-Key Electronics’ Internet of Things (IoT) Resource Center Inspires the Future: Read More
IoT devices use different communication and messaging protocols at different layers. While developing an IoT device, the selection of the protocol largely depends on the type, layer, and function to be performed by the device. MQTT, XMPP, DDS, AMQP, and CoAP are a few of the widely used communication protocols for the IoT application layer. Let us understand each of them in greater detail.
MQTT (Message Queue Telemetry Transport)
MQTT is a machine-to-machine (M2M) protocol. It is a publish-subscribe-based messaging protocol used to communicate device data to the servers. The main purpose of MQTT is to manage IoT devices remotely. It is mainly used when a huge network of small devices needs to be monitored or managed via the Internet, i.e. parking sensors, underwater lines, energy grid, etc.
- Lightweight for constrained networks
- Flexibility to choose Quality of Services with the given functionality
- Standardized by OASIS Technical Committee
- Easy and quick to implement
- High power consumption due to the TCP-based connection
- Lack of encryption
A parking lot where there are a number of parking sensors installed to identify the number and location of empty or vacant parking spots.
XMPP (Extensible Messaging and Presence Protocol)
XMPP was originally developed as a messaging protocol known as Jabber. It uses an XML format for messaging. The main feature of this protocol is its addressing mechanism. It identifies the devices/nodes in the IoT network using the address known as Jabber ID (JID). JID follows the standard — email@example.com. This addressing mechanism enables two nodes to exchange information, regardless of how far the nodes are in the network.
XMPP messages are usually 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 an XML stream by sending an opening <stream> tag. The server then replies with an XML stream back to the client. Since XMPP is an open protocol, anyone can have their own XMPP server in their network without necessarily connecting to the Internet.
- Addressing scheme to identify devices on the network
- Client-server architecture
- Text-based messaging, no end-to-end encryption provision
- No Quality of Service provision
- A smart thermostat that can be accessed from a smartphone via a web server.
- A gaming console with instant messaging between the two online players.
DDS (Data Distribution Service)
DDS is also based on a publish-subscribe model. DDS connects the devices directly, unlike MQTT, which connects them to the server. This is why DDS is faster than MQTT. Apparently, it can deliver millions of messages to a number of different receivers in seconds, as it eliminates the communication with the server. DDS can be utilized for providing device-to-device communication over the data bus. It provides detailed Quality of Service and reliability.
Based on a simple “publish-subscribe” communication paradigm
Flexible and adaptable architecture that supports “auto-discovery” of new or stale endpoint applications
Low overhead — can be used with high-performance systems
Deterministic data delivery
Efficient use of transport bandwidth
Military systems, wind farms, hospital integration, medical imaging, asset-tracking systems, and automotive test and safety.
AMQP (Advanced Message Queuing Protocol)
Advanced Message Queuing Protocol (AMQP) is an open standard application layer protocol for sending transactional messages between servers. As a message-centric middleware, it can process thousands of reliable queued transactions. AMQP is focused on not losing messages, as messages can be transferred using TCP or UDP. The use of TCP provides a reliable point-to-point connection. Furthermore, endpoints must acknowledge the acceptance of each message. The standard also describes an optional transaction mode with a formal multiphase commit sequence. True to its origins in the banking industry, AMQP focuses on tracking messages and ensuring each message is delivered as intended, regardless of failures or reboots.
Messages can be sent over TCP and UDP
Provides end-to-end encryption
Relatively high resource utilization, i.e. power and memory usage
AMQP is mostly used in business messaging. It usually defines devices like mobile handsets, communicating with back-office data centers.
All the above-listed protocols are uniquely applicable to different operating scenarios. Any protocol can be handpicked based on their pros and cons for IoT application development. The main factors to consider while choosing any one of them for your application is quality of service, security, and the reliability that your application requires.
Opinions expressed by DZone contributors are their own.