Install Mosquito broker
https://mosquitto.org/download/1. Install service easily by some click.
2. Check operation
Reference: http://www.steves-internet-guide.com/install-mosquitto-broker/
- open command prompt and check installed directory
cd C:\Program Files\mosquitto
mosquitto -h or mosquitto -v
- start service
mosquitto -p 1883
- check port 1883 is listening or not
netstat -a
- add system environment variables.
Add below string to the system environment path. It helps you call mosquito in the command line window.
;C:\Program Files\mosquitto
Example
Reference: https://www.win.tue.nl/~lrahman/iot_2016/tutorial/MQTT_2016.pdf1. Open the first command windows
2. Start mosquitto by command
mosquitto -p 1883
3. Open the second command windows
4. Allow client subcribe the topic by command
mosquitto_sub -t 'test/topic' -v
This time, a client has the ability to handle the message from publisher.
5. Open the third command windows
6. Publish message by command
mosquitto_pub -t 'test/topic' -m “very_first_msg”
7. Look at the second command to see the message content which is sent by the publisher.
'test/topic' very_first_msg
Comments
Post a Comment