Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is MQTT?

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "what MQTT is". The explanation in this article is simple and clear, easy to learn and understand. Please follow the ideas of Xiaobian and go deep into it slowly to study and learn "what MQTT is" together.

MQTT, DDS, XMPP, CoAP, RESTFul HTTP, which is better for IoT applications?

An agreement is a rule that two parties have to do something, and both parties must abide by the agreed content before they can do something together. Now in the era of Internet of Everything, more and more devices are connected to cloud platforms through the Internet. In the Internet of Things technology framework system, the communication protocols used mainly include: MQTT, DDS, XMPP, CoAP, RESTFul HTTP, etc. Which of these commonly used IoT application layer protocols is better suited for IoT applications?

The terminal nodes of the Internet of Things are generally embedded devices with limited storage and bandwidth. More complex protocols are not suitable for embedded system applications. For example, the XMPP protocol is based on XML. For embedded devices, XML parsing is super difficult. In addition, HTTP protocol for embedded devices is a heavyweight is not very suitable, more suitable for embedded devices is lightweight CoAP and MQTT.

1. RESTFul HTTP protocol introduction

RESTful is a resource-based software architecture style, the Internet is the most basic and most extensive application layer protocol, so the most important or HTTP protocol itself. I usually visit websites and fill in some URLs in the address bar to access relevant web pages, but how can I see web pages because of the long list of things I type? Let's explore the display process of the web page together: the browser sends a request to the Web server according to the URL provided, the Web server receives the request and processes it to generate a response and sends it to the browser, the browser parses the document in the response that meets the HTML specification format requirements, and the document is parsed so that the web page is displayed. This interactive process is a series of operations from the client to the server using the HTTP (HyperText Transfer Protocol) protocol as a specification.

The main characteristics of HTTP can be summarized as follows: support for client/server mode, request-response type, flexible header specification, HTTP allows transmission of arbitrary types of data objects, and the type being transmitted is marked by Content-Type. There are terminal short connections and long connections. The meaning of short connections is to limit each connection to only one request. After the server processes the client's request and receives the client's response, it disconnects the connection, reducing the concurrent pressure on the server. HTTP is a stateless protocol, which means that the protocol has no memory for transactions. The lack of state means that if the preceding information is needed for subsequent processing, it must be retransmitted, which may lead to an increase in the amount of data transmitted per connection. HTTP in general is too heavy and inflexible for embedded devices.

CoAP Protocol

In recent years, more and more devices have been connected to each other, and the number of these devices will far exceed the number of humans. In this context, the Internet of Things and M2M technologies have emerged. While connecting to the Internet may seem convenient and easy for humans, it is very difficult for tiny devices to connect to the Internet. In today's PC world, information exchange is accomplished via TCP and the application layer protocol HTTP. But for the average device, implementing the HTTP protocol is obviously an excessive requirement. CoAP was designed to allow small devices to access the Internet.

Both COAP and HTTP operate on server-side resources through four request methods (GET, PUT, POST, Delete). The obvious difference between the two is that HTTP describes the content of the protocol package through text description, and the protocol package will contain some spaces, newlines, etc., and the protocol package is very readable. COAP describes the content of a protocol package by defining binary bit field functions. Therefore, the COAP protocol package size is smaller and more compact, and the smallest protocol package of COAP protocol is only 4B. The protocol package needs to be parsed to know the specific content inside. Another obvious difference is that the traditional HTTP protocol is a one-way communication between the host and the web server. CoAP Client and CoAP server can communicate bidirectionally, and both parties can actively send requests to each other.

MQTT protocol (low bandwidth)

MQTT (Message Queuing Telemetry Transport ), an instant messaging protocol developed by IBM, is more suitable for Internet of Things scenarios. MQTT protocol adopts publish/subscribe mode. All IoT terminals are connected to the cloud through TCP. The cloud manages the communication content concerned by each device through the theme and is responsible for forwarding messages between devices.

MQTT takes into account the differences in computing performance of different devices when designing the protocol, so all protocols are encoded and decoded in binary format, and the codec format is very easy to develop and implement. The smallest data packet is only 2 bytes, and it has good adaptability for low power and low speed networks. There is a very complete QOS mechanism, and three message delivery modes can be selected according to the service scenario: at most once, at least once, and exactly once. It runs on TCP protocol and supports TLS(TCP+SSL) protocol, and since all data communication goes through the cloud, security is well guaranteed.

MQTT is suitable for providing data transmission and monitoring of cloud-based remote devices over low-bandwidth, unreliable networks. It has the following characteristics: (1) it uses a proxy-based publish/subscribe messaging model to provide one-to-many message publishing;(2) it uses TCP/IP to provide network connectivity;(3) it has small transport overhead (fixed-length headers are 2 bytes) and protocol exchanges are minimized to reduce network traffic; and (4) it supports QoS, with three message publishing qualities of service: "at most once,""at least once," and "only once."

4. DDS protocol

DDS(Data Distribution Service for Real-Time Systems) is a data distribution service for real-time systems, which is a protocol proposed by the famous OMG organization. Its authority should prove the future application prospect of this protocol. DDS protocol is suitable for distributed high reliability, real-time transmission equipment data communication, and has been widely used in defense, civil aviation, industrial control and other fields.

DDS has the following characteristics: (1) data-centric;(2) agentless publish/subscribe messaging model, point-to-point, point-to-many, many-to-many; and (3) up to 21 QoS policies.

DDS supports data distribution and device control between devices, data transmission between devices and cloud, and the real-time efficiency of DDS data distribution is very high, which can simultaneously distribute millions of messages to many devices in seconds. DDS provides many ways to guarantee QoS, which is why it is suitable for high reliability and safety applications such as defense military and industrial control. However, these applications all work on wired networks, and no implementation cases have been seen in wireless networks, especially in resource-constrained situations.

XMPP (Instant Messaging)

XMPP(Extensible Messaging and Presence Protocol) Extensible messaging and presentation protocol, XMPP predecessor is Jabber, an open source form of organization produced by the network instant messaging protocol. XMPP is currently standardized by the IETF International Standards Organization. XMPP is suitable for instant messaging applications, but also for network management, content feeding, collaboration tools, file sharing, games, remote system monitoring and so on. It is characterized by: (1) a client/server communication model;(2) a distributed network;(3) a simple client that does most of the work on the server side; and (4) an XML data format that is a subset of the standard Universal Markup Language.

XMPP is an XML-based protocol, which is widely used in Internet instant messaging applications due to its openness and ease of use. Compared with HTTP, XMPP is more suitable for Internet of Things systems in terms of communication business processes. Developers do not have to spend too much effort to solve the business communication process when communicating with devices, and the relative development cost will be lower. XMPP protocol is mature, powerful, scalable, and currently mainly used in many chat systems, but the protocol is complex, redundant (based on XML), expensive traffic, expensive electricity, and expensive to deploy hardware.

VI. Comparison of communication protocols

From the current development trend of Internet of Things applications, MQTT protocol has certain advantages, because at present, major cloud computing service providers at home and abroad, such as Alibaba Cloud, AWS, Baidu Cloud, Azure and Tencent Cloud (Cloud) all support MQTT protocol. Another reason is that the MQTT protocol matures earlier than CoAP, so MQTT has a certain first-mover advantage, but with the intelligent and multi-change development of the Internet of Things, the subsequent Internet of Things application platform will definitely be compatible with more Internet of Things application layer protocols.

Thank you for reading, the above is the content of "MQTT is what", after the study of this article, I believe that everyone has a deeper understanding of what MQTT is, and the specific use situation needs to be verified by practice. Here is, Xiaobian will push more articles related to knowledge points for everyone, welcome to pay attention!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report