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:40] jk [Subscription Wildcard Examples] |
tut:mqtt [2018-07-20 18:23] jk [Subscription Wildcard Examples] |
||
---|---|---|---|
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 92: | Line 94: | ||
|1|saved on broker| | |1|saved on broker| | ||
- | ===== Subscription Wildcard Examples ===== | + | ===== 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 | ||
+ | |||
+ | ===== Subscribtion Wildcard Examples ===== | ||
==== Exact Match ==== | ==== Exact Match ==== | ||
Line 153: | Line 179: | ||
* /MyGarden/Air**/Temperature** | * /MyGarden/Air**/Temperature** | ||
* /MyGarden/Pool**/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> | ||