Watson IoT Platform - MQTT - Node-REDでMQTTの基本動作を確認

初めてWatson IoT Platformを使ってみよう、というかたのためのガイドです。
[Watson IoT Platformを使ってみる](http://qiita.com/egplnt/items/af867711a7191923b2ff)でIoTアプリを準備しました。
[MessageSightを動かす](http://qiita.com/egplnt/items/246205f6574cde268712)でMQTTブローカーとしてMessageSightを準備しました。
[Node-REDをローカル環境で稼働させる](http://qiita.com/egplnt/items/39f4794504fc27823bb4)
と[Watson IoT Platform - MQTT - Node-REDからpub/subする](http://qiita.com/egplnt/items/2105158291f4857aa7b0)でNode-REDからpub/subできるようにしました。

#一対多の通信
- [Node-REDのフローをコピーする方法](http://qiita.com/egplnt/items/84b244a50d8bdaced324)を参照して以下のフローをコピペします。


```lang:Node-REDでMQTTの練習
[{"id":"fac58d0f.dee3e8","type":"mqtt-broker","z":"d5a876a5.e9ace8","broker":"172.16.100.100","port":"1883","clientid":"","usetls":false,"verifyservercert":true,"compatmode":true,"keepalive":"60","cleansession":true,"willTopic":"","willQos":"0","willRetain":null,"willPayload":"","birthTopic":"","birthQos":"0","birthRetain":null,"birthPayload":""},{"id":"b1ec1387.cd7e8","type":"inject","z":"d5a876a5.e9ace8","name":"","topic":"","payload":"こんにちは","payloadType":"str","repeat":"","crontab":"","once":false,"x":120,"y":80,"wires":[["f65fa076.4979b8"]]},{"id":"11098816.20d498","type":"debug","z":"d5a876a5.e9ace8","name":"","active":true,"console":"false","complete":"false","x":670,"y":80,"wires":[]},{"id":"3ca78e60.54be5a","type":"mqtt in","z":"d5a876a5.e9ace8","name":"","topic":"/topic/test","broker":"fac58d0f.dee3e8","x":500,"y":80,"wires":[["11098816.20d498"]]},{"id":"f65fa076.4979b8","type":"mqtt out","z":"d5a876a5.e9ace8","name":"","topic":"/topic/test","qos":"","retain":"","broker":"fac58d0f.dee3e8","x":310,"y":80,"wires":[]},{"id":"a3bb26db.df0148","type":"debug","z":"d5a876a5.e9ace8","name":"","active":true,"console":"false","complete":"false","x":670,"y":140,"wires":[]},{"id":"2bcfd9f4.3a4616","type":"mqtt in","z":"d5a876a5.e9ace8","name":"","topic":"/topic/test","broker":"fac58d0f.dee3e8","x":500,"y":140,"wires":[["a3bb26db.df0148"]]},{"id":"f3c76190.62f738","type":"debug","z":"d5a876a5.e9ace8","name":"","active":true,"console":"false","complete":"false","x":670,"y":200,"wires":[]},{"id":"af961600.7f636","type":"mqtt in","z":"d5a876a5.e9ace8","name":"","topic":"/topic/test","broker":"fac58d0f.dee3e8","x":500,"y":200,"wires":[["f3c76190.62f738"]]},{"id":"723f03a9.207764","type":"debug","z":"d5a876a5.e9ace8","name":"","active":true,"console":"false","complete":"false","x":670,"y":260,"wires":[]},{"id":"c2209559.6bfc48","type":"mqtt in","z":"d5a876a5.e9ace8","name":"","topic":"/topic/test","broker":"fac58d0f.dee3e8","x":500,"y":260,"wires":[["723f03a9.207764"]]},{"id":"23212172.9c6b66","type":"debug","z":"d5a876a5.e9ace8","name":"","active":true,"console":"false","complete":"false","x":670,"y":320,"wires":[]},{"id":"d02b2c3.ddb465","type":"mqtt in","z":"d5a876a5.e9ace8","name":"","topic":"/topic/test","broker":"fac58d0f.dee3e8","x":500,"y":320,"wires":[["23212172.9c6b66"]]}]

```
- mqttノードを開いて使用しているMessageSightのアドレスを指定します。
![スクリーンショット 2016-05-26 11.56.15.png](https://qiita-image-store.s3.amazonaws.com/0/125842/8432a88f-7a8e-943a-aee6-48d55765b754.png)

- 一対多の通信が簡単に実現できる事を確認します。
![スクリーンショット 2016-05-26 12.49.56.png](https://qiita-image-store.s3.amazonaws.com/0/125842/366ee474-e26b-7a05-b692-9382d4f7d8d1.png)



#多対一の通信
- 前項を参照して下記のようなフローを作成し、多対一の通信が簡単に実現できる事を確認します。
![スクリーンショット 2016-05-26 12.59.47.png](https://qiita-image-store.s3.amazonaws.com/0/125842/c1599c6c-87a1-6686-34c6-9bc812093af0.png)