You might be quite surprised with why I have mentioned about Mosquitto might be the coffee hasn’t kicked in yet ?
Nah… Read it again it’s “mosquitto” there’s a extra “t” not the insect which hums to wake you up from sleep but it’s a MQTT message queuing telemetry transport protocol which works on the subscribe
publish model over TCP/IP.
The mosquitto is a open source MQTT broker from eclipse however there are other brokers available other than mosquitto.
So what is the MQTT broker?
It’s a piece of software that acts as a interface between the subscriber the one who subscribes for a topic and receives message and the publisher the one who publishes the message on the particular topic.The topic is a channel with an unique Identity.

Let us consider the example of Television , the subscriber is the one who requests the operator to telecast particular channels and the publisher is the operator who telecasts only the channels subscribed by the subscriber.
MQTT protocol works similarly.
MQTT protocol is used in IoT applications, smartphones and embedded devices.
You can use mosquitto by installing mosquitto Debian package
sudo apt-get install mosquitto
sudo apt-get install libmosquitto-dev
Subscribe for a topics
mosquitto_sub -t test
Publish on a topic
mosquitto_pub -t test -m "Hello"
Run this commands on 2 separate terminals “Et Voila!”
For more information on topics refer here
https://mosquitto.org/man/mqtt-7.html
The mosquitto configuration file can be found here which provides wide range of options like the port number,ip address and security configurations.
https://mosquitto.org/man/mosquitto-conf-5.html
The maximum payload size is 268MB which I have tried on a PC and it works seamlessly without any issues.
There are 3 kinds of message QoS supported by MQTT
QoS0- fire and forget
QoS1- the broker sends a acknowledgement of message received
QoS2- the broker sends the acknowledgement of message received and the sender also replies that the acknowledgement is received to the broker
There are some API’s which can be referred here for development of application using mosquitto
https://mosquitto.org/api/files/mosquitto-h.html
References:
https://mosquitto.org/
