Andy Stanford-Clark of IBM and Alan Nip of Cirrus Link wrote the first version of the protocol in 1999. In 2013, IBM submitted the MQTT version 3.1 specification to the Structured Information Standards Promotion Organization, with relevant charters to ensure that only a small number of changes can be made to the specification.
The MQTT (Message Queue Telemetry Transport) protocol is a message protocol based on the publish/subscribe paradigm under the ISO standard (ISO/IEC PRF 20922). It works on the TCP/IP protocol family and is a publish/subscribe message protocol designed for remote devices with low hardware performance and poor network conditions.
MQTT is a client-server based message publishing/subscribing transport protocol. The MQTT protocol is lightweight, simple, open and easy to implement. These characteristics make it widely applicable. Such as: machine-to-machine (M2M) communication and Internet of Things (IoT). They are also widely used in communicating sensors via satellite links, occasional dial-up medical devices, smart homes, and some miniaturized devices.
Due to the particularity of the IoT environment, MQTT design needs to comply with the following specifications:
① Streamlined, without adding dispensable functions;
② Publish/Subscribe (Pub/Sub) mode to facilitate message transfer between sensors;
③ Allow users to dynamically create topics, zero operation and maintenance costs;
④ Minimize the amount of transmission to improve transmission efficiency;
⑤ Take factors such as low bandwidth, high latency, and unstable network into consideration;
⑥ Support continuous session control;
⑦ Understand that the computing power of the client may be low;
⑧ Provide service quality management;
⑨ Assuming that the data is agnostic, the type and format of the transmitted data are not required to maintain flexibility.
The MQTT protocol is a protocol designed for communication between remote sensors and control devices in low-bandwidth, unreliable networks. It has the following main characteristics:
① Use the publish/subscribe message mode to provide one-to-many message publishing and decouple application programs.
② Message transmission for payload content masking.
③ Use TCP/IP to provide network connection.
④ There are three kinds of message publishing service qualities: "at most once", "at least once" and "only once".
⑤ Small transmission, small overhead (fixed-length header is 2 bytes), protocol exchange is minimized to reduce network traffic.
⑥ Use the Last Will and Testament features to notify the relevant parties of the mechanism of abnormal client interruption.
The realization of the MQTT protocol requires the completion of communication between the client and the server. During the communication process, there are three identities in the MQTT protocol: Publisher (Publish), Broker (Server), and Subscriber (Subscribe). Among them, the publisher and subscriber of the message are clients, the message agent is the server, and the publisher of the message can be the subscriber at the same time.
The message transmitted by MQTT is divided into two parts: topic (Topic) and load (payload):
Topic, which can be understood as the type of message, after the subscriber subscribes (Subscribe), he will receive the message content (payload) of the topic;
payload, which can be understood as the content of the message, refers to the specific content that the subscriber wants to use.
An MQTT client is an application or device using the MQTT protocol that always establishes a network connection to a server. Clients can be:
(1) Publish information that other clients may subscribe to;
(2) Subscribe to messages published by other clients;
(3) Unsubscribe or delete messages from the app;
(4) Disconnect from the server.
The MQTT server is called a "message broker" (Broker), which can be an application or a device. It is located between message publishers and subscribers. It can accept network connections from customers; accept application information published by customers; process subscription and unsubscribe requests from clients; and forward application messages to subscribed customers.