User Tools


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Next revision Both sides next revision
tut:mqtt [2018-06-22 16:59]
jk created
tut:mqtt [2018-07-20 18:23]
jk [Subscription Wildcard Examples]
Line 3: Line 3:
 ... see [[https://​en.wikipedia.org/​wiki/​MQTT|Wikipedia]] ... see [[https://​en.wikipedia.org/​wiki/​MQTT|Wikipedia]]
  
 +... 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 90: 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
 +
 +===== Subscribtion 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>​
 +
 +
  
  
  

ezPiC

Easy *Pi Controller for IoT Devices