Ubuntuã§MQTTããã¼ã«ã¼ãæ§ç¯
AWS IoTãçºè¡¨ããã¦MQTTãã¾ãçãä¸ãã£ã¦ãã¾ããï¼ ä»æ¥ã¯èªåã§MQTTããã¼ã«ã¼ãæ§ç¯ãã¦è©¦ãã¦ã¿ãã®ã§åèé²ãæ®ãã¦ããã¾ãã MQTTã®èª¬æã«ã¤ãã¦ã¯ãããä¸ã«ãã詳ããä¸å¯§ãªæ å ±ãä¹ã£ã¦ãã¾ãã®ã§ãããã§ã¯å²æã
Ubuntu 14.04ä¸ã§Mosquittoã使ã£ãMQTTããã¼ã«ã¼ï¼ãµã¼ãï¼ãæ§ç¯ãã¾ãã
Mosquitto
ããã±ã¼ã¸ãªã¹ãã«ãªãã¸ããªã追å
kyoro@iot:~$ sudo add-apt-repository ppa:mosquitto-dev/mosquitto-ppa [sudo] password for kyoro: More info: https://launchpad.net/~mosquitto-dev/+archive/ubuntu/mosquitto-ppa Press [ENTER] to continue or ctrl-c to cancel adding it gpg: keyring `/tmp/tmpmtjlhsxh/secring.gpg' created gpg: keyring `/tmp/tmpmtjlhsxh/pubring.gpg' created gpg: requesting key 262C4500 from hkp server keyserver.ubuntu.com gpg: /tmp/tmpmtjlhsxh/trustdb.gpg: trustdb created gpg: key 262C4500: public key "Launchpad mosquitto" imported gpg: Total number processed: 1 gpg: imported: 1 (RSA: 1) OK
ããã±ã¼ã¸ãªã¹ãã®æ´æ°
kyoro@iot:~$ sudo apt-get update
ã¯ã©ã¤ã¢ã³ãã®å°å ¥
sudo apt-get install mosquitto-clients
ããã¼ã«ã¼ï¼ãµã¼ãï¼ã®å°å ¥
sudo apt-get install mosquitto
Mosquittoå°å ¥å®äºï¼
æ¥ç¶ãã¹ã
ã¯ã©ã¤ã¢ã³ãã§testãè³¼èª
kyoro@iot:~$ mosquitto_sub -d -t test Client mosqsub/12779-iot sending CONNECT Client mosqsub/12779-iot received CONNACK Client mosqsub/12779-iot sending SUBSCRIBE (Mid: 1, Topic: test, QoS: 0) Client mosqsub/12779-iot received SUBACK Subscribed (mid: 1): 0
ã¿ã¼ããã«ãå¥ã«éãã¦ã¡ãã»ã¼ã¸ãpublish
kyoro@iot:~$ mosquitto_pub -d -t test -m "Hello world!" Client mosqpub/12852-iot sending CONNECT Client mosqpub/12852-iot received CONNACK Client mosqpub/12852-iot sending PUBLISH (d0, q0, r0, m1, 'test', ... (12 bytes)) Client mosqpub/12852-iot sending DISCONNECT
ã¯ã©ã¤ã¢ã³ãå´ã§åä¿¡ããã¾ã
Client mosqsub/12779-iot received PUBLISH (d0, q0, r0, m0, 'test', ... (12 bytes)) Hello world!
ãã£ã¡ããæ軽ã§ããï¼
次åã¯èªè¨¼ãã©ã°ã¤ã³ã®å°å
¥ããã£ã¦ã¿ããã¨æãã¾ãã
â»ãããªãã¨ããååã®è¨äºããï¼å¹´ä»¥ä¸ããã°æ¾ç½®ãã¦ã¦ãããâ¦ï¼