From f9d95f812b53fcb365522babe39d518b01a7b624 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Sat, 21 Apr 2018 14:20:40 +0200 Subject: wip --- what-is-iot.md | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 56 insertions(+), 9 deletions(-) (limited to 'what-is-iot.md') diff --git a/what-is-iot.md b/what-is-iot.md index 3b1b570..da61d82 100644 --- a/what-is-iot.md +++ b/what-is-iot.md @@ -239,7 +239,9 @@ Note that the "total length" field is 16 bits, 2 bytes, it's maximum value is 64 ![](images/IP-Header_eng.pdf) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# Lecture: ESP8266 aka NodeMCU aka ESP-12 +# Lecture: ESP8266 + +!comment(aka NodeMCU aka ESP-12) ## ESP8266 software layers @@ -274,14 +276,16 @@ Agents have one of two roles: * *Broker* (aka Server) * Handles network connections - * Keeps subscription state + * Keeps subscriptions * Manages client * Disconnects * *(last) will* - * Persistence + * Persistence of retained messages ::: notes +network connections: this includes removing closed sockets, client's that doesn't respons to timeouts and duplicate clients. + http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/mqtt-v3.1.1.html Subscriptions are not permanent. The connection is (unlike HTTP) @@ -364,16 +368,62 @@ The central application is split: ::: +## MQTT - The protocol - Retained message + +Message is kept by the server even after disconnect + +* `CONNECT` +* `PUBLISH` + * `RETAIN` + * `$app/$device/temperature` + * `22.3` +* `DISCONNECT` + +Later on: + +* `SUBSCRIBE` + * `$app/#/temperature` +* `PUBLISH` + * `$app/$device/temperature` + * `22.3` + +::: notes + +The last PUBLISH is an incoming message + +::: + +## MQTT - The protocol - Will message + +Message sent when you disconnect + +Client #1: + +1. `CONNECT` + * `WILL TOPIC: $app/$device/online` + * `WILL PAYLOAD: 0` +1. `PUBLISH` + * `$app/$device/online` + * `1` +1. `DISCONNECT` + +Broker + +1. *To all subscribers* `PUBLISH` + * `$app/$device/online` + * `0` + ## MQTT - Patterns Må utvides Explain: -* Message sizes with MQTT -* "will" messages * Push vs pull, central applications can push to clients * mostly mqtt, some http +* Client id - sparker ut gamle koblinger +* Keep alive / ping meldinger +* Alternative transporter - websockets(!) ## MQTT - Implementations @@ -395,7 +445,7 @@ Not sure about ActiveMQ but it is at least a part of the project so it is releas * Amazon IoT * Google Cloud IoT * Microsoft Azure IoT - * CloudMQTT + * CloudMQTT (at Heroku) * DIY * ThingMQ @@ -410,9 +460,6 @@ In between are: ::: - -# Notes - # Assignments ## Assignment 1: Blink a led -- cgit v1.2.3