Windows Command prompt as Publisher and Subscriber
Before you start using Windows Command Prompt as Publisher and Subscriber, You need to install MQTT Broker on Windows Machine or Computer.
Please click the following link for installing MQTT broker on Windows machine.
Installing MQTT Broker on Windows Computer
1)Open Command Prompt as Administrator. Steps given below.
Search command Prompt in your computer -> Right click on command prompt -> Run as Administrator
2)Navigate to Mosquitto Installed folder or path. For navigation use following command
cd C:\Program Files (x86)\mosquitto
3)Execute the following Command to Subscribe topic test.
Host name(-h) is localhost because Broker and subscriber are running on same the machine. You can also use host name as IP address of Computer on which broker is installed.
1)Open another Command Prompt as Administrator.
2)Navigate to mosquitto installed folder or path.
3)Execute the following Commands to Publish message Temp:10 & Temp:20.
Host name(-h) is localhost because Broker and Publisher are running on same the machine. You can also use host name as IP address of Computer on which broker is installed.
Now check your Subscriber command prompt, you should get data
Temp:10
Temp:20;
Please click on the below link to become master in MQTT.