Slide 1

Slide 1 text

COPYRIGHT ©2019 SHINGO FUKUI ʮMQTT ׬શʹཧղͨ͠ʯ͔Β Ұา౿Έग़ͯ͠Έͨ 2019೥7݄19೔ IoTറΓͷษڧձ! IoTLT vol.53 @LINE ෱Ҫ ᚸޗ

Slide 2

Slide 2 text

COPYRIGHT ©2019 SHINGO FUKUI ࣗݾ঺հ ෱Ҫᚸޗ @SilkAndTikit ιϑτ΢ΣΞΤϯδχΞʢJavaScript, Java, , Lisp, Cʣ IoTΤϯδχΞʹస޲தɹ 2 IoTϋϯζΦϯ։࠵ ࣗಈਫ΍Γػ৬ਓ https://iot-gym.connpass.com ຊͷ຋༁

Slide 3

Slide 3 text

COPYRIGHT ©2019 SHINGO FUKUI ए͍ਓʹΑ͘આڭ͍ͯͨ͠ 3 QiitaͷίϐϖͰ΍Γաͯͨ͝͠Β੒௕͠ͳ͍Αɻ ͪΌΜͱجຊͷ࢓૊ΈΛֶ͹ͳͪ͘Όɻ ࿝֐

Slide 4

Slide 4 text

COPYRIGHT ©2019 SHINGO FUKUI ͦΕͳͷʹɺ ɹMQTTͷίʔυΛίϐϖͯ͠ࡁ·͍ͤͯͨʂ 4

Slide 5

Slide 5 text

COPYRIGHT ©2019 SHINGO FUKUI MQTT
 Broker ίϐϖͰ΋MQTTͷجຊ͸Θ͔ͬͨ 5 MQTT Client ϓϩτίϧ͕ܰྔͰIoTʹ޲͍͍ͯΔ ొ৔ਓ෺͸ Broker ͱ Client Publish / Subscribe ܕ௨৴ MQTT Client Topic A Topic B "Hello" Publisher Subscriber Publish "Hello" to B

Slide 6

Slide 6 text

COPYRIGHT ©2019 SHINGO FUKUI ίϐϖ͚ͩͩͱ
 ɹΘ͔Βͳ͍͜ͱ͕৭ʑग़͖ͯͨ ͲͷBrokerɺͲͷClientιϑτΛ࢖͏͔ʁ ϒϥ΢βͰMQTT௨৴͢Δํ๏͸ʁ ར༻ऀΛݶఆ͢Δํ๏͸ʁ Node-RedͰMQTTΛར༻͢Δํ๏͸ʁ 6 ͦ͜ͰɺجຊΛֶΜͰΈͨ ͍͔ͭ͘঺հ

Slide 7

Slide 7 text

COPYRIGHT ©2019 SHINGO FUKUI MQTTͷ௨৴ͷछྨ 7 TCP઀ଓɹmqtt://αʔόΞυϨε:1883/ Client Broker TCP

Slide 8

Slide 8 text

COPYRIGHT ©2019 SHINGO FUKUI MQTTͷ௨৴ͷछྨ 8 TCP઀ଓɹmqtt://αʔόΞυϨε:1883/ Client WebSocket઀ଓɹws://αʔόΞυϨε:9001/ ϒϥ΢β JavaScript Broker Broker WebSocket TCP

Slide 9

Slide 9 text

COPYRIGHT ©2019 SHINGO FUKUI ҉߸Խͳ͠ MQTTͷ௨৴ͷछྨ 9 TCP઀ଓɹmqtt://αʔόΞυϨε:1883/ Client WebSocket઀ଓɹws://αʔόΞυϨε:9001/ ϒϥ΢β JavaScript Broker Broker WebSocket TCP

Slide 10

Slide 10 text

COPYRIGHT ©2019 SHINGO FUKUI ҉߸Խͳ͠ MQTTͷ௨৴ͷछྨ 10 TCP઀ଓɹmqtt://αʔόΞυϨε:1883/ Client WebSocket઀ଓɹws://αʔόΞυϨε:9001/ ϒϥ΢β JavaScript Broker Broker TLS҉߸Խ Client WebSocket઀ଓɹwss://αʔόΞυϨε:443/ ϒϥ΢β JavaScript Broker Broker WebSocket
 + TLS TCP+TLS TCP઀ଓɹmqtts://αʔόΞυϨε:8883/ WebSocket TCP

Slide 11

Slide 11 text

COPYRIGHT ©2019 SHINGO FUKUI ར༻ऀೝূͷछྨ ೝূͳ͠ʢanonymousʣ ID, PASSWORDͰೝূ ʢClientূ໌ॻͰೝূʣ 11

Slide 12

Slide 12 text

COPYRIGHT ©2019 SHINGO FUKUI ௨৴ͷछྨͷશύλʔϯ 2 x 2 x 2 = 8ύλʔϯ 12 TCP WebSocket ҉߸Խͳ͠ TLS Clientೝূͳ͠ ID, PASSWORD X X ஫ɿClientূ໌ॻ͸লུ

Slide 13

Slide 13 text

COPYRIGHT ©2019 SHINGO FUKUI ࣮ݧͷਐΊํ: 1εςοϓͣͭෳࡶԽ 13 MQTT.js mosquitto mosquitto TCP TCP Client Broker ID,PW MQTT.js ID,PW TCP mosquitto MQTT.js mosquitto WebSocket WebSocket WebSocket TLS MQTT.js TLS TCP+TLS mosquitto 1. 2. 3. 4. 5.

Slide 14

Slide 14 text

COPYRIGHT ©2019 SHINGO FUKUI Node-RedͰMQTT Clientͱͯ͠࢖͍͍ͨ BrokerΛNode-Red಺Ͱಈ͔͍ͨ͠ 14

Slide 15

Slide 15 text

COPYRIGHT ©2019 SHINGO FUKUI PublishϊʔυɺSubscribeϊʔυΛ࢖͏ Clientͱͯ͠࢖͍͍ͨ 15 MQTT
 Broker subscribe publish

Slide 16

Slide 16 text

COPYRIGHT ©2019 SHINGO FUKUI PublishϊʔυɺSubscribeϊʔυΛ࢖͏ Clientͱͯ͠࢖͍͍ͨ 16 MQTT
 Broker subscribe publish Node-RedͱBrokerΛηοτͰఏڙ͢Δ
 Ϋϥ΢υαʔϏε΋͋Δ

Slide 17

Slide 17 text

COPYRIGHT ©2019 SHINGO FUKUI Node-Red಺ͰBrokerΛಈ͔͍ͨ͠ 17 node.jsͰॻ͔ΕͨMQTT Broker ʮMoscaʯ͕ϊʔυͱͯ͠ಈ͘ ʮύϨοτͷ؅ཧʯͰnode-red-contrib-mqtt-brokerΛ௥Ճ͢Δ TCP , WebSocket྆ରԠɻID,PASSWORD͸? TLS͸ʁ Node-RedαʔόʔͷMQTTϙʔτ͕ղ์͞Ε͍ͯΕ͹֎෦ػثͱ௨৴Ͱ͖Δ subscribe publish Broker

Slide 18

Slide 18 text

COPYRIGHT ©2019 SHINGO FUKUI جຊΛֶͿ͜ͱ͸େࣄʂ 18

Slide 19

Slide 19 text

COPYRIGHT ©2019 SHINGO FUKUI ݁࿦ɿ͜Ε͔Β΋આڭΛଓ͚Δ 19 ϝϯλʔ ࿝֐ QiitaͷίϐϖͰ΍Γաͯͨ͝͠Β੒௕͠ͳ͍Αɻ ͪΌΜͱجຊͷ࢓૊ΈΛֶ͹ͳͪ͘Όɻ