#author("2021-07-23T02:14:36+00:00","default:hotate","hotate") #author("2023-01-02T06:45:43+00:00","default:hotate","hotate") #contents &tag(IoT,通信); * 情報 [#s5e812a8] - [[名が体を表していないMQTT、単純で自由なIoTプロトコル | 日経 xTECH(クロステック)>https://tech.nikkeibp.co.jp/atcl/nxt/column/18/00006/00010/?P=1]] もっともMQTTという名前自体には大した意味はありません。それどころかMQTTにはメッセージをためる(Queue)機能はなく、MQTTという名前は“名が体を表していない”という妙なことになっています。 ** v5.0 [#hc1afeac] - [[[AWS IoT Core] MQTT v5 を使用してリクエスト・レスポンス パターンを実装して見ました | DevelopersIO>https://dev.classmethod.jp/articles/aws-iot-core-mqtt-v5-request-response/]] (2022/11/30) 今回、MQTT v5 を使用して、「リクエスト・レスポンス」のパターンを実装してみました。 * Mosquitto [#d1b8455b] ** 情報 [#vbdfd582] - [[MQTT入門(導入編) - Qiita>https://qiita.com/pocket8137/items/0205b7a1c0b38890523e]] MQTTプロトコルを実装したオープンソースソフトウェア。 ** v2.0 [#t45735cb] - [[Version 2.0.0 released. | Eclipse Mosquitto>https://mosquitto.org/blog/2020/12/version-2-0-0-released/]] Breaking changes When the Mosquitto broker is run without configuring any listeners it will now bind to the loopback interfaces 127.0.0.1 and/or ::1. This means that only connections from the local host will be possible. - [[Migrating from 1.x to 2.0 | Eclipse Mosquitto>https://mosquitto.org/documentation/migrating-to-2-0/]] Authentication requires configuration This means that allow_anonymous now defaults to false. If you currently have a broker running that has a listener configured in the configuration file, but has no other authentication configured and no explicit allow_anonymous setting, then your clients will be unable to connect after upgrading to Mosquitto 2.0. ** [[macOS]] [#qa94fa3e] - [[HomebrewでOS XにMosquittoをインストールする - Qiita>https://qiita.com/yohei1126@github/items/de355f540a83743213fb]] -- コメント:下記の設定を追加するとログにタイムスタンプが出力される。ただし、実行時にファイル指定が必要。(2020/05/01) $ vim /usr/local/etc/mosquitto/mosquitto.conf ... log_timestamp true log_timestamp_format %Y-%m-%dT%H:%M:%S ... $ mosquitto -c /usr/local/etc/mosquitto/mosquitto.conf 2020-05-01T16:03:44: mosquitto version 1.6.9 starting 2020-05-01T16:03:44: Config loaded from /usr/local/etc/mosquitto/mosquitto.conf. 2020-05-01T16:03:44: Opening websockets listen socket on port 9090. 2020-05-01T16:03:44: Opening ipv6 listen socket on port 1883. 2020-05-01T16:03:44: Opening ipv4 listen socket on port 1883. ** [[Homebrew]] [#ka75150d] - [[Homebrew: Could not symlink, /usr/local/bin is not writable - Stack Overflow>https://stackoverflow.com/questions/26647412/homebrew-could-not-symlink-usr-local-bin-is-not-writable]] For those who are looking for /usr/local/sbin is not writable error: $ cd /usr/local $ sudo mkdir sbin $ sudo chown -R $(whoami) $(brew --prefix)/* $ brew link yourPackageName -- コメント: "brew doctor"を実行して問題が見つかった場合、上記の指示が出る。(2020/05/01) Warning: Homebrew's sbin was not found in your PATH but you have installed formulae that put executables in /usr/local/sbin. Consider setting the PATH for example like so: echo 'export PATH="/usr/local/sbin:$PATH"' >> ~/.zshrc ** [[ログ]] [#t69d5deb] - [[Amazon LinuxにMQTTブローカーMosquittoをインストールしてログ出力させる | Developers.IO>https://dev.classmethod.jp/articles/setting-up-mosquitto-logging-on-amazon-linux/]] ログ出力先は log_dest で指定します。 ** [[コマンド]] [#ue220214] - 受信側 -- [[MQTTで始めるIoTデバイスの作り方 第1回:「MQTT」を知り「Mosquitto」を導入する (2/3) - MONOist(モノイスト)>https://monoist.atmarkit.co.jp/mn/articles/1605/23/news017_2.html]] >mosquitto_sub -h 192.168.1.16 -t "#" -v - 送信側 -- [[MQTTで始めるIoTデバイスの作り方 第1回:「MQTT」を知り「Mosquitto」を導入する (3/3) - MONOist(モノイスト)>https://monoist.atmarkit.co.jp/mn/articles/1605/23/news017_3.html]] >mosquitto_pub -h 192.168.1.16 -t arduino/d2/ -m "1" * MQTT.js [#ae948674] - [[mqttjs/MQTT.js: The MQTT client for Node.js and the browser>https://github.com/mqttjs/MQTT.js]] The MQTT client for Node.js and the browser - [[Node.js+MQTT.js+Mosca を使ってみた - Qiita>https://qiita.com/tinymouse/items/7cccdc68597ade264ee1]] MQTT.js は、MQTT クライアントのためのライブラリです。Node.js およびブラウザの JavaScript で使用できます。 -- コメント: Moscaは[[Aedes]] という別プロジェクトへ移行していた。(2020/05/01) --- [[moscajs/mosca: MQTT broker as a module>https://github.com/moscajs/mosca]] This project is UNMAINTAINED. Please move to Aedes - [[Node.jsでMQTTブローカーを立てて、ブラウザから確認する - Qiita>https://qiita.com/n0bisuke/items/629799710d5834e98b93]] Webサーバー(のフレームワーク)としてexpress、Brokerサーバーとしてmoscaを利用します。 -- 関連:[[Express]] -- コメント:BrokerにMosquittoを使う場合、[[WebSocket]]アクセス用に別途ポートを明示する必要がある。(2020/05/01) --- [[mosquittoでMQTTとWebSocket両方に対応させる - 人と技術のマッシュアップ>http://tomowatanabe.hatenablog.com/entry/2016/01/21/095007]] --- [[MQTT: mosquittoをwebsocket対応にするには - Qiita>https://qiita.com/idev_jp/items/b450524a6f30f3a4f86e]] listener 9090 protocol websockets - [[ブラウザだけでMQTT Pub/Sub からのリアルタイムストリーミングのチャート作成 - Qiita>https://qiita.com/narutaro/items/2697b8f89e42f821a764]] (2020/5/6) MQTT.js で Mosquitto™ のテストサーバへ Pub / Sub Vue.js と Chart.js でストリーミングを可視化 -- 関連:[[Vue.js]], [[Chart.js]] * [[AWS]] [#p795ea05] ** [[AWSIoT]] [#u16847ef] - [[Raspi(デバイス)とAWSIoT(クラウド)間でMQTTを使ってメッセージを送受信する - Qiita>https://qiita.com/is_ryo/items/ecf822b12513be1bc156]] AWSIoTとラズパイ間の通信をMQTTでつなぎ、送受信する手順を紹介します - [[[AWS IoT] MQTTを使用して、Lambdaからブラウザを更新する方法〜aws-iot-device-sdk(aws-iot-sdk-browser-bundle.js)を使用する場合〜 | DevelopersIO>https://dev.classmethod.jp/articles/aws-iot-browser-refresh/]] (2019/02/08) 今回は、MQTTを使用して、Lambdaからブラウザをリロードしてみたいと思います。 -- [[ブラウザで Amplify の PubSub を使ってサーバからの push を受ける - Qiita>https://qiita.com/iwaiktos/items/6b758819c7a5b59beb19]] (2020/07/26) 確かに、 aws-iot-device-sdk よりも amplify のほうがコードは簡単になっている。が、このとっつきにくさは何なんだろう…。 ** [[Ruby]] [#ybeb3021] - [[AWS IoTとRuby製MQTTクライアントでPub/Subしてみた - Qiita>https://qiita.com/hiroeorz@github/items/f933ad1158a08506922a]] AWS IoT(AWS上でサーバーインスタンスを自分で用意する事なくMQTTブローカー(+α)のサービスを利用できる)をRubyクライアント(ruby-mqtt)から試してみた個人的なメモです。 ** [[Lambda]]/[[Amplify]] [#na035132] - [[MQTTメッセージでLambdaからブラウザを更新する 〜Vue+Amplify編 | DevelopersIO>https://dev.classmethod.jp/articles/mqtt-amplify-veu/]] (2021/05/03) やってることは、全く同じなのですが、今回は、これをAWS Amplify(以下、Amplify)で作成してみました。 * [[Python]] [#w818874f] - [[Raspberry Pi で paho-mqtt を使う - Qiita>https://qiita.com/ekzemplaro/items/14ab3b599a6785187f6f]] * 関連 [#ge8b14e3] #related #taglist(tag=MQTT)