What is Mosquitto MQTT?
Eclipse Mosquitto is an open source (EPL/EDL licensed) message broker that implements the MQTT protocol versions 5.0, 3.1.1 and 3.1. Mosquitto is lightweight and is suitable for use on all devices from low power single board computers to full servers.
The MQTT protocol provides a lightweight method of carrying out messaging using a publish/subscribe model. This makes it suitable for Internet of Things messaging such as with low power sensors or mobile devices such as phones, embedded computers or microcontrollers.
In MQTT there are a few basic concepts that you need to understand:
-
Publish/Subscribe - In a publish and subscribe system, a device can publish a message on a topic, or it can be subscribed to a particular topic to receive messages.
-
Messages - Messages are the information that you want to exchange between your devices. This can either be a command or data.
-
Topics - Topics are the way you register interest for incoming messages or how you specify where you want to publish the message.
-
Broker - The broker is primarily responsible for receiving all messages, filtering the messages, decide who is interested in them and then publishing the message to all subscribed clients.
In MQTT, a publisher (device/client) publishes messages on a topic and a subscriber must subscribe to that topic to view the message.
Figure 1 : The Mosquitto MQTT Publish/Subscribe model