For communication using MQTT, follow the steps below:
Install Mosquitto from the link https://mosquitto.org/download/.
Start the server by typing Mosquitto
in the terminal/cmd.
For publishing messages to a topic, expand the libraries list and click on the Communication library.
Subscribe to the same topic to check if the message is sent. Node-RED was used here to subscribe to the topic.
Execute the flow.
For subscribing to a topic and receiving messages, expand the libraries list and click on the Communication library.
Drag and drop an MQTT Subscribe node.