MQTT is basically designed as a lightweight protocol to support the Internet of Things (IoT) applications. An MQTT broker is a mediator that enables MQTT clients to communicate. The resposibility of MQTT broker is to receive messages published by clients, the topics are used filter the messages , and distributes them according to the topics ppreferred by the subscribers. MQTT brokers enable the publish/subscribe (pub/sub) pattern of communication that helps to create a highly efficient and scalable MQTT protocol. This sample helps you to install MQTT broker Contiki-NG simulator.
Install MQTT Broker Packages
Open a new Terminal window.
Type the following Command to install MQTT broker.
sudo apt-get install -y mosquitto mosquitto-clients.
And then type sudo Password
After entering sudo password, MQTT broker packages will install.
Type the Command to check the version of MQTT broker
>> mosquitto -vThe Installed mosquitto version is 3.1 broker.
Type the following Command to connect the MQTT broker
>> mosquitto -p port address
If the port address is already in use then try another port address.