What is MQTT? An

MQTT is a lightweight, publish-subscribe network protocol that transports messages between  IOT and IIOT devices. The MQTT protocol usually runs over TCP/IP. It is designed for connections with remote locations where a “small code footprint” is required or the network bandwidth is limited. The protocol is an open OASIS standard and an ISO recommendation (ISO/IEC 20922).MQTT protocol is an ideal choice & vastly used for IIOT device, IOT, Smart Home systems, Home Automation systems applications.

End nodes with the ESP8266, ESP32, Raspberry Pi & Arduino microcontrollers communicate with other MQTT Clients is perfect use case for makers, Freelancers & prototypes.

MQTT Publish_Subscribe Pattern

How MQTT plays an important role in
IOT/IIOT/Smart Home system/Home
Automation Systems?

The MQTT protocol defines two types of network entities: a message broker and a number of clients. An MQTT broker is a server that receives all messages from the clients and then routes the messages to the appropriate destination clients.

Even a Raspberry Pi, ESP8266, ESP32, Arduino & other small footprint controllers works as MQTT Client.

An MQTT client is any device (from a micro controller up to a fully-fledged server) that runs an MQTT library and connects to an MQTT broker over a network.

When a publisher has a new item of data to distribute, it sends a control message with the data to the connected broker. The MQTT broker then distributes the information to any MQTT clients that have subscribed to that topic.

The publisher does not need to have any data on the number or locations of subscribers and subscribers in turn do not have to be configured with any data about the publishers.

If a broker receives a message on a topic for which there are no current subscribers, the broker discards the message unless the publisher of the message designated the message as a retained message. A retained message is a normal MQTT message with the retained flag set to true. The broker stores the last retained message and the corresponding QoS for the selected topic.

Each client that subscribes to a topic pattern that matches the topic of the retained message receives the retained message immediately after they subscribe. The broker stores only one retained message per topic. This allows new subscribers to a topic to receive the most current value rather than waiting for the next update from a publisher.

When a publishing client first connects to the broker, it can set up a default message to be sent to subscribers if the broker detects that the publishing client has unexpectedly disconnected from the broker.

Clients only interact with a broker, but a system may contain several broker servers that exchange data based on their current subscribers’ topics.

A minimal  MQTT control message can be as little as two bytes of data.

A control message can carry nearly 256 megabytes of data if needed. There are defined message types used to connect and disconnect a client from a broker to publish data to acknowledge receipt of data, and to supervise the connection between client and server.

MQTT relies on the TCP protocol for data transmission. 

Standard TCP Protocol : 1883 , Encrypt : 8883

Visit www.mqtt.org

For information about MQTT