what is mosquitto protocol (MQTT) ?

 Mosquitto is an open-source message broker that implements the MQTT (Message Queuing Telemetry Transport) protocol. The MQTT protocol is a lightweight messaging protocol designed for use in Internet of Things (IoT) and Machine-to-Machine (M2M) communication.

Mosquitto provides a way for devices and applications to exchange messages with each other over a network using the MQTT protocol. It acts as an intermediary between devices, allowing them to publish messages to topics and subscribe to topics to receive messages from other devices.

The Mosquitto broker can be installed on a server or other network-connected device, and can be configured to provide secure authentication and encryption of messages. It can also be integrated with other software systems and platforms using APIs and plugins.

Mosquitto is widely used in IoT and M2M applications due to its lightweight and efficient design, which makes it suitable for use on low-power devices and networks with limited bandwidth. It also provides features such as message persistence and quality of service (QoS) guarantees, which ensure that messages are delivered reliably and efficiently.

Overall, Mosquitto and the MQTT protocol provide a scalable and flexible way to connect devices and applications in an IoT or M2M network, and are increasingly popular in industries such as home automation, energy management, and industrial automation.


It was first developed by IBM in 1999 and later standardized by OASIS in 2014.

MQTT is designed to be simple and efficient, with a small code footprint and minimal bandwidth usage. It uses a publish-subscribe messaging model, where devices can publish messages to topics and subscribe to topics to receive messages from other devices. The protocol also supports message retention and quality of service (QoS) levels to ensure that messages are delivered reliably and efficiently.

MQTT uses a broker-based architecture, where a message broker acts as an intermediary between devices, handling message routing and delivery. Devices can connect to the broker using a TCP/IP network connection and publish or subscribe to topics using a simple messaging format.

MQTT supports three levels of QoS:

  • QoS 0 (At most once delivery): Messages are delivered at most once, without any confirmation. This level provides the least reliability but the highest efficiency.
  • QoS 1 (At least once delivery): Messages are delivered at least once, with confirmation required from the recipient. This level provides reliable delivery but with some potential for message duplication.
  • QoS 2 (Exactly once delivery): Messages are delivered exactly once, with confirmation required from both the sender and the recipient. This level provides the highest reliability but with the highest overhead.

MQTT is widely used in IoT and M2M applications due to its lightweight and efficient design, which makes it suitable for use on low-power devices and networks with limited bandwidth. It is also designed to be highly scalable, with support for millions of devices and brokers in a single network.