This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
tut:mqtt [2018-07-20 10:09] jk [What is MQTT] |
tut:mqtt [2018-07-20 12:08] jk [What is MQTT] |
||
---|---|---|---|
Line 4: | Line 4: | ||
... see [[https://www.hivemq.com/blog/mqtt-essentials-part-1-introducing-mqtt]] | ... see [[https://www.hivemq.com/blog/mqtt-essentials-part-1-introducing-mqtt]] | ||
+ | |||
+ | ... see [[https://blog.doubleslash.de/mqtt-fuer-dummies/]] | ||
===== MQTT Data Flow by Examples ===== | ===== MQTT Data Flow by Examples ===== | ||
Line 91: | Line 93: | ||
|0|fire and forget| | |0|fire and forget| | ||
|1|saved on broker| | |1|saved on broker| | ||
+ | |||
+ | ===== Topic Wording ===== | ||
+ | |||
+ | There is no law that you have to name your topics in a special way. So the following names are (principle) correct: | ||
+ | |||
+ | * /MyHome/Kitchen/Temperature | ||
+ | * /MYHOME/KITCHEN/TEMPERATURE | ||
+ | * MyHome/Kitchen/Temperature | ||
+ | * MyHome.Kitchen.Temperature | ||
+ | * MyHomeKitchenTemperature | ||
+ | * MHKT | ||
+ | * /Temperature/Kitchen/MyHome | ||
+ | * 42 | ||
+ | |||
+ | But there are some guidelines for names that all clinets can filter and handle subscriptions in an easy way: | ||
+ | |||
+ | * The topic begins with a '/' | ||
+ | * The topic do NOT end with a '/' | ||
+ | * A '/' seperates topic levels | ||
+ | * The topic levels starts with the most commen level | ||
+ | |||
+ | So the recommented name is: | ||
+ | |||
+ | * /MyHome/Kitchen/Temperature | ||
+ | |||
+ | ===== Subscription Wildcard Examples ===== | ||
+ | |||
+ | ==== Exact Match ==== | ||
+ | |||
+ | On subscriping **"/MyHome/Kitchen/Temperature"** you get: | ||
+ | * **/MyHome/Kitchen/Temperature** | ||
+ | * <del>/MyHome/Kitchen/Humity</del> | ||
+ | * <del>/MyHome/Kitchen/Fridge/Temperature</del> | ||
+ | * <del>/MyHome/Livingroom/Temperature</del> | ||
+ | * <del>/MyHome/Livingroom/Humity</del> | ||
+ | * <del>/MyGarden/Air/Temperature</del> | ||
+ | * <del>/MyGarden/Pool/Temperature</del> | ||
+ | |||
+ | ==== # Wildcard ==== | ||
+ | |||
+ | On subscriping **"/#"** you get: | ||
+ | * /MyHome/Kitchen/Temperature | ||
+ | * /MyHome/Kitchen/Humity | ||
+ | * /MyHome/Kitchen/Fridge/Temperature | ||
+ | * /MyHome/Livingroom/Temperature | ||
+ | * /MyHome/Livingroom/Humity | ||
+ | * /MyGarden/Air/Temperature | ||
+ | * /MyGarden/Pool/Temperature | ||
+ | |||
+ | On subscriping **"/MyHome/#"** you get: | ||
+ | * **/MyHome/**Kitchen/Temperature | ||
+ | * **/MyHome/**Kitchen/Humity | ||
+ | * **/MyHome/**Kitchen/Fridge/Temperature | ||
+ | * **/MyHome/**Livingroom/Temperature | ||
+ | * **/MyHome/**Livingroom/Humity | ||
+ | * <del>/MyGarden/Air/Temperature</del> | ||
+ | * <del>/MyGarden/Pool/Temperature</del> | ||
+ | |||
+ | On subscriping **"/MyHome/Kitchen/#"** you get: | ||
+ | * **/MyHome/Kitchen/**Temperature | ||
+ | * **/MyHome/Kitchen/**Humity | ||
+ | * **/MyHome/Kitchen/**Fridge/Temperature | ||
+ | * <del>/MyHome/Livingroom/Temperature</del> | ||
+ | * <del>/MyHome/Livingroom/Humity</del> | ||
+ | * <del>/MyGarden/Air/Temperature</del> | ||
+ | * <del>/MyGarden/Pool/Temperature</del> | ||
+ | |||
+ | ==== + Wildcard ==== | ||
+ | |||
+ | On subscriping **"/MyHome/+/Temperature"** you get: | ||
+ | * **/MyHome/**Kitchen**/Temperature** | ||
+ | * <del>/MyHome/Kitchen/Humity</del> | ||
+ | * <del>/MyHome/Kitchen/Fridge/Temperature</del> | ||
+ | * **/MyHome/**Livingroom**/Temperature** | ||
+ | * <del>/MyHome/Livingroom/Humity</del> | ||
+ | * <del>/MyGarden/Air/Temperature</del> | ||
+ | * <del>/MyGarden/Pool/Temperature</del> | ||
+ | |||
+ | On subscriping **"/+/+/Temperature"** you get: | ||
+ | * /MyHome/Kitchen**/Temperature** | ||
+ | * <del>/MyHome/Kitchen/Humity</del> | ||
+ | * <del>/MyHome/Kitchen/Fridge/Temperature</del> | ||
+ | * /MyHome/Livingroom**/Temperature** | ||
+ | * <del>/MyHome/Livingroom/Humity</del> | ||
+ | * /MyGarden/Air**/Temperature** | ||
+ | * /MyGarden/Pool**/Temperature** | ||
+ | |||
+ | On subscriping **"/+/+/+/Temperature"** you get: | ||
+ | * <del>/MyHome/Kitchen/Temperature</del> | ||
+ | * <del>/MyHome/Kitchen/Humity</del> | ||
+ | * /MyHome/Kitchen/Fridge**/Temperature** | ||
+ | * <del>/MyHome/Livingroom/Temperature</del> | ||
+ | * <del>/MyHome/Livingroom/Humity</del> | ||
+ | * <del>/MyGarden/Air/Temperature</del> | ||
+ | * <del>/MyGarden/Pool/Temperature</del> | ||
+ | |||
+ | |||