Linux Terminal as Publisher and Subscriber
Before you start using Linux terminal as Publisher or Subscriber, You need to install MQTT Broker on Linux. Please click on following link to Install MQTT Broker on Linux machine.
Installing MQTT Broker on Linux
1)Open Linux terminal
2)Execute the Following Command to publish data on topic test
1)Open Linux terminal
2)Execute the Following Command to Subscribe topic test
Here Broker , Publisher and Subscriber all are running on same Linux machine because of that host name is localhost. To see data Published by publisher , Please first follow the Subscriber steps and then follow the Publisher steps.
Please click on the below link to become master in MQTT.