MQTT Client, Mosquitto → MQTT Message Topic, Publish, Subscribe
PC Exercise ← Connecting to MQTT Broker/server with PC client (Socket without Security)
The test is very simple,
but it can be said that it is meaningful to finally try to communicate with an MQTT server/broker for the first time.
1. Test system configuration
♦ We will run the MQTT broker on the PC and run a total of 3 clients.
♦ Client_1 sets to subscribe to a topic called /momo,
♦ Client_2 is set to subscribe to the topic /toto.
♦ Client_3 executes to publish the message “Hi, momo” to the topic /momo.
Who can receive messages? , it’s pretty obvious…
2. MQTT PC Test Procedure
Step1. Open windows cmd window and check the IP address of the PC to be used as a broker.
Any path> ipconfig
⊕ The IP for the result of ipconfig is used in step 3.
Step2. Run MQTT broker/server in windows cmd window.
~ mosquitto>mosquitto -v
Step3. Open a new windows cmd window and run Client_1 that subscribes to /momo.
~/mosquitto>mosquitto_sub -h 192.168.0.2 -t /momo
Step4. Open a new windows cmd window and run Client_2 that subscribes to /toto.
~/mosquitto>mosquitto_sub -h 192.168.0.2 -t /toto
Step5. Open a new windows cmd window and try to publish the message “Hi, MOMO” to the topic /momo.
~/mosquitto>mosquitto_pub -h 192.168.0.4 -t /momo -m “Hi, MOMO”
짜~잔 !~~~~~
3. MQTT PC Test Result
The test result didn’t go as expected.