What is MQTT? Difference between mqtt protocol and http protocol

Summary: What is MQTT? MQTT (Message Queuing Telemetry Transport) is translated as: Message Queuing Telemetry Transport, which is a lightweight communication protocol used to transmit messages on the network. MQTT was originally released by IBM and later became an open standard of OASIS (Organization for the Advancement of Structured Information Standards).

    What is MQTT? MQTT (Message Queuing Telemetry Transport) is translated as: Message Queuing Telemetry Transport, which is a lightweight communication protocol used to transmit messages on the network. MQTT was originally released by IBM and later became an open standard of OASIS (Organization for the Advancement of Structured Information Standards). MQTT is specifically designed to transmit messages in small, low-bandwidth, high-latency or unstable network environments, and is widely used in Internet of Things (IoT) and machine-to-machine (M2M) communications .

The core design concept     of MQTT is the publish/subscribe (Publish/Subscribe) model , in which the publisher of the message (Publisher) publishes the message to a specific topic (Topic), and the subscriber of the message (Subscriber) receives it by subscribing to a specific topic news . This model decouples the sender and receiver of messages, and supports flexible and dynamic message communication modes.

    MQTT provides some key features, including:

    Lightweight : MQTT is a lightweight protocol that uses a binary protocol format and compact message headers , making it low bandwidth and storage consumption in resource-constrained environments.

    Reliability : MQTT supports three different message delivery quality levels (QoS): 0, 1 and 2, and the appropriate QoS level can be selected according to application requirements to ensure reliable message delivery.

    Flexibility : MQTT provides a rich topic (Topic) and subscription (Subscription) mechanism , which can support multi-level topics and wildcards, so that the publication and subscription of messages can be flexibly managed and controlled.

    Security : MQTT supports encrypted transmission based on TLS/SSL , which can ensure the security and confidentiality of messages during transmission. At the same time, MQTT also supports authentication and authorization mechanisms, which can perform identity verification and authorization management on clients.

   Wide application : MQTT is widely used in the Internet of Things and M2M fields, and is used in various scenarios, such as sensor networks, remote monitoring, smart homes, industrial automation, and Internet of Vehicles.

    Difference between mqtt protocol and http protocol

    1. Communication model : MQTT is a protocol based on the publish/subscribe (Publish/Subscribe) model , in which an MQTT server (also known as an MQTT proxy or MQTT proxy server) is responsible for publishing and subscribing intermediary data . And HTTP is a protocol based on the request/response (Request/Response) model , the client sends a request and waits for the server to respond.

    2. Data transmission method : MQTT uses a lightweight binary protocol to transmit data, and transmits data through TCP/IP or other transport layer protocols, with low bandwidth and resource consumption. HTTP uses a text protocol to transfer data, usually over TCP/IP.

    3. Connection retention : MQTT supports persistent connection and reconnection after disconnection. The client can maintain a long-term connection and receive push data sent by the server. And HTTP is a stateless protocol, each request needs to re-establish the connection.

    4. Real-time : MQTT supports real-time message push, which is suitable for scenarios with high real-time requirements, such as Internet of Things (IoT) applications. HTTP is generally a request/response model, not suitable for real-time data transmission.

    5. Network overhead : MQTT generally has lower network overhead because it uses a binary protocol and supports compression. However, HTTP uses a text protocol, which may generate large network overhead.

    6. Security : MQTT supports SSL/TLS encrypted transmission, which can guarantee data security. HTTP can also be transmitted encrypted over HTTPS, but the default is clear text transmission.

    7. Applicable scenarios : MQTT is usually used in the Internet of Things (IoT) and sensor networks, and is suitable for scenarios that need to transmit real-time data. HTTP is suitable for transferring large text data or scenarios that require a request/response model, such as web browsing and client/server applications.

Guess you like

Origin blog.csdn.net/liuqinhou/article/details/130875218