Introduction and comparison of seven IoT message protocols
This article lists seven messaging technologies in the Internet of Things communication on the market – namely the application layer protocols working in network communication, summarizing their respective characteristics, specific IoT application scenarios, and so on.
These protocols are used directly for communication between devices and between people and devices in a wireless or wired network environment, and IoT developers will deal with these protocols.
Problem space for IoT connection
The above picture shows the problem space of the IoT connection. The communication environment of the Internet of Things is Ethernet, Wi-Fi, RFID, NFC (Near Field Communication), Zigbee, 6LoWPAN (IPV6 low-speed wireless version), Bluetooth, GSM, GPRS, GPS. , 3G, 4G and other networks, and each communication application protocol has a certain scope of application. AMQP, JMS, and REST/HTTP all work on Ethernet. The COAP protocol is a protocol developed specifically for resource-constrained devices, and the compatibility between DDS and MQTT is much stronger.
Brief introduction to the protocols
• MQTT (Message Queuing Telemetry Transport), Message Queuing Telemetry Transport, an instant messaging protocol developed by IBM, is now the recommended standard for OASIS;
• DDS (Data Distribution Service for Real-Time Systems), a data distribution service for real-time systems. This is a protocol proposed by the famous OMG organization. Its authority should prove the future application prospects of the protocol;
• Advanced Message Queuing Protocol (AMQP), which was proposed by the OASIS organization. The organization has proposed the OSLC (Open Source Lifecyle) standard for data exchange between business systems such as PLM, ERP, and MES.
• XMPP (Extensible Messaging and Presence Protocol) extends communication and presentation protocols. XMPP was formerly known as Jabber, a network instant messaging protocol generated by an open source organization. XMPP is currently being standardized by the IETF International Standards Organization;
• JMS (Java Message Service), JAVA message service, which is a well-known message queue protocol in the JAVA platform;
• REST (Representational State Transfer), which characterizes state transitions, is a communication style developed based on the HTTP protocol and is not currently a standard;
• CoAP (Constrained Application Protocol), a restricted application protocol that is applied to protocols in wireless sensor networks.
All of these protocols have been widely used, and each protocol has at least 10 code implementations, all claiming to support real-time publish/subscribe IoT protocols, but in the design of specific IoT system architecture, consider Select the appropriate protocol for the communication needs of the actual scenario.
Here is an example of a smart home, indicating that these protocols focus on the application direction. Intelligent lighting control in smart home, you can use XMPP protocol to control the switch of the light; smart home power supply, power plant engine group monitoring can use DDS protocol; when power is delivered to thousands of households, power line inspection and maintenance can Use the MQTT protocol; the power consumption of all appliances in the home can be transmitted to the cloud or home gateway for analysis using the AMQP protocol; finally, users want to publish their own energy query service to the Internet, then they can use REST/HTTP to open API service.
Below we will detail these protocols in detail:
MQTT protocol (low bandwidth)
Scope of application: Provide data transmission and monitoring of remote devices based on cloud platforms under low bandwidth and unreliable networks.
• Provide one-to-many message publishing using an agent-based publish/subscribe messaging model
• Provide network connectivity using TCP/IP
• Small transmission with low overhead (fixed length header is 2 bytes), protocol exchange is minimized to reduce network traffic
• Support QoS, there are three types of message publishing service quality: “at most once”, “at least once”, “only once”
The main implementation and application of the agreement:
• There are already protocol frameworks for multiple languages such as PHP, JAVA, Python, C, C#, etc.
• An important part of IBM Bluemix is its IoT Foundation service, a cloud-based MQTT instance
• Mobile apps have long used MQTT, such as Facebook Messenger and com
The MQTT protocol is generally applicable to device data collection to the end (Device->Server, Device->Gateway), centralized star network architecture (hub-and-spoke), not applicable to communication between devices and devices, device control capability is weak, and The real-time performance is poor, generally in the second level.
DDS protocol (high reliability, real time)
Scope of application: distributed high reliability, real-time transmission equipment data communication. At present, DDS has been widely used in defense, civil aviation, industrial control and other fields.
• Use agentless publish/subscribe messaging mode, peer-to-peer, point-to-multipoint, many-to-many
• How many 21 QoS quality of service strategies are provided
The main implementation of the agreement:
• OpenDDS is an open source C++ implementation
• OpenSplice DDS
DDS supports data distribution and device control between devices, data transmission between devices and the cloud, and DDS data distribution is very efficient in real-time, enabling millions of messages to be distributed to multiple devices simultaneously in seconds. DDS provides a lot of guarantees in terms of quality of service (QoS), which is why it is suitable for high reliability and security applications in defense military and industrial control. However, these applications all work under wired networks. In the case of wireless networks, especially when resources are limited, there have been no implementation cases.
AMQP protocol (interoperability)
Scope of application: The earliest application of transaction messaging between financial systems. In IoT applications, it is mainly suitable for communication and analysis between mobile handheld devices and back-end data centers.
• Wire-level protocol, which describes the format of data transmitted over the network, in bytes.
• For messaging, queuing, routing (including peer-to-peer and publish/subscribe), reliability, security
• Implementations in Erlang have RabbitMQ
• Open source implementation of AMQP, writing OpenAMQ in C language
• Apache Qpid
XMPP protocol (instant messaging)
Scope: Instant messaging applications can also be used in network management, content feed, collaboration tools, file sharing, gaming, remote system monitoring, and more.
• Client/server communication mode
• Distributed network
• Simple client, put most of the work on the server side
• Data format of a subset of the standard universal markup language XML
The XMPP protocol is based on XML text to transmit instant messaging commands. It was originally designed to interconnect and intercommunication services. In some IoT applications, it is used to send more complex operational commands to the device for device control.
REST/HTTP (loosely coupled service call)
Scope: REST/HTTP is mainly to simplify the system architecture in the Internet, quickly realize the loose coupling between the client and the server, and reduce the interaction delay between the client and the server. Therefore, it is suitable for the application level of the Internet of Things, and the resources in the Internet of Things are opened by REST to realize that the service is called by other applications.
• REST refers to a set of architectural constraints and principles. An application or design that satisfies these constraints and principles is RESTful
• The interaction between the client and the server is stateless between requests
• On the server side, application state and functionality can be divided into various resources that are exposed to the client. Examples of resources are: application objects, database records, algorithms, and so on. Each resource uses a URI (Universal Resource Identifier) to get a unique address. All resources share a unified interface to transfer status between the client and server
• Use standard HTTP methods such as GET, PUT, POST, and DELETE
Comments: REST/HTTP is actually the Internet service in the API calling package style, IoT data collection to the Internet of Things application system, in the Internet of Things application system, you can open the REST API, open the data service, by the Internet Called by other applications.
Scope: CoAP is a RESTful API that simplifies the HTTP protocol. CoAP is an application layer protocol in the 6LowPAN protocol stack. It is suitable for IP networks in resource-constrained communications.
• CoAP uses a binary header instead of a text header in the HTTP protocol.
• CoAP reduces the number of content type options in the header, such as removing text/html (UTF-8), image/jpeg, video/raw, etc.
The main implementation of the agreement:
• libcoap (C language implementation)
• Californium (java language implementation)
CoAP and 6LowPan, which are respectively an application layer protocol and a network adaptation layer protocol, aim to solve the communication requirement that the device is directly connected to the IP network, that is, the application of the IP technology to the device, and between the Internet and the device. Because IPV6 technology brings huge addressing space, not only solves the problem of identification of huge devices and resources in the future, applications on the Internet can directly access devices supporting IPV6 without additional gateways.
There are two characteristics of the above several protocols that need to be considered when selecting IoT communication technologies:
• Publish/subscribe service is more suitable for communication in the IoT environment
DDS, MQTT, AMQP and JMS are all based on the publish/subscribe mode. The publish/subscribe framework has the characteristics of service self-discovery, dynamic expansion and event filtering. It solves the rapid acquisition of data sources and the addition of objects in the application layer of the Internet of Things system. With problems such as exiting, interest subscription, and reducing bandwidth traffic, the connection of the object is loosely coupled in space (the two sides do not need to know the communication address), loosely coupled in time, and loosely coupled.
• Quality of Service (QoS) is an important consideration in IoT communications
With the help of service policies, DDS can effectively control and manage the use of resources such as network bandwidth and memory space, as well as control the reliability, real-time and data lifetime of data. Through flexible use of these quality of service policies, DDS A data distribution system that meets real-time requirements can be developed not only in a narrowband wireless environment but also in a broadband wired communication environment.