Mosquitto test
1. Install Mosquitto broker
$ sudo apt-get install mosquitto
$ netstat -nap | grep 1883
tcp 0 0 0.0.0.0:1883 0.0.0.0:* LISTEN -
tcp6 0 0 :::1883 :::* LISTEN -
2. Install Mosquitto client
$ sudo apt-get install mosquitto-clients
3. Test Pub/Sub
- subscribing "hello/world" Topic
$ mosquitto_sub -d -t hello/world
Client mosqsub/7013-dkyun77-Th sending CONNECT
Client mosqsub/7013-dkyun77-Th received CONNACK
Client mosqsub/7013-dkyun77-Th sending SUBSCRIBE (Mid: 1, Topic: hello/world, QoS: 0)
Client mosqsub/7013-dkyun77-Th received SUBACK
Subscribed (mid: 1): 0
(after executing the following command of mosquitto_pubg)
Client mosqsub/7013-dkyun77-Th received PUBLISH (d0, q0, r0, m0, 'hello/world', ... (11 bytes))
Hello World
$ mosquitto_pub -d -t hello/world -m "Hello World"
Client mosqpub/6973-dkyun77-Th sending CONNECT
Client mosqpub/6973-dkyun77-Th received CONNACK
Client mosqpub/6973-dkyun77-Th sending PUBLISH (d0, q0, r0, m1, 'hello/world', ... (11 bytes))
Client mosqpub/6973-dkyun77-Th sending DISCONNECT
4. Appendix
$ mosquitto_sub --help
-d : enable debug messages.
-t : mqtt topic to subscribe to. May be repeated multiple times.
...
$ mosquitto_pub --help
-d : enable debug messages.
-t : mqtt topic to publish to.
-m : message payload to send.
...
$ sudo apt-get install mosquitto
$ netstat -nap | grep 1883
tcp 0 0 0.0.0.0:1883 0.0.0.0:* LISTEN -
tcp6 0 0 :::1883 :::* LISTEN -
2. Install Mosquitto client
$ sudo apt-get install mosquitto-clients
3. Test Pub/Sub
- subscribing "hello/world" Topic
$ mosquitto_sub -d -t hello/world
Client mosqsub/7013-dkyun77-Th sending CONNECT
Client mosqsub/7013-dkyun77-Th received CONNACK
Client mosqsub/7013-dkyun77-Th sending SUBSCRIBE (Mid: 1, Topic: hello/world, QoS: 0)
Client mosqsub/7013-dkyun77-Th received SUBACK
Subscribed (mid: 1): 0
(after executing the following command of mosquitto_pubg)
Client mosqsub/7013-dkyun77-Th received PUBLISH (d0, q0, r0, m0, 'hello/world', ... (11 bytes))
Hello World
$ mosquitto_pub -d -t hello/world -m "Hello World"
Client mosqpub/6973-dkyun77-Th sending CONNECT
Client mosqpub/6973-dkyun77-Th received CONNACK
Client mosqpub/6973-dkyun77-Th sending PUBLISH (d0, q0, r0, m1, 'hello/world', ... (11 bytes))
Client mosqpub/6973-dkyun77-Th sending DISCONNECT
4. Appendix
$ mosquitto_sub --help
-d : enable debug messages.
-t : mqtt topic to subscribe to. May be repeated multiple times.
...
$ mosquitto_pub --help
-d : enable debug messages.
-t : mqtt topic to publish to.
-m : message payload to send.
...
댓글
댓글 쓰기