MQTT (Message Queue Telemetry Transport) is a publish subscribe messaging protocol for use on top of the TCP/IP protocol. It is designed for connections with remote locations where a small code footprint is required or the network bandwidth is limited.
Mosquitto is an open-source message broker service that uses the MQTT protocol to send and receive messages, typically with IOT (Internet of Things) devices.
MQTT has following components
Broker is responsible for coordinating the communication between publishers and subscribers. It can also store messages while subscribers are offline
The Publisher sends a message to the network.
The Subscriber listens for messages with a particular topic.
A message has a topic and a payload, like the subject and the content of an e-mail
In order to run complete system, Mosquitto Broker service is required to run on a machine which is always ON. Client binaries needs to be installed on Subscriber device and Publisher Device.
There is a free Mosquitto Broker available at Eclipse IoT but if you want to install it in your own device/server then follow below steps.
Mosquitto Broker can be installed on any device. Here I’ll show you how to install it on a Debian based system.
sudo apt-get install mosquitto
This installs and also starts the mosquitto daemon. You can check if it is working by issuing following command.
service mosquitto status
If you prefer more secured environment then follow below steps to configure Broker.