# Listen to all sub-messages on a MQTT path

**URL:** <https://discourse.nodered.org/t/listen-to-all-sub-messages-on-a-mqtt-path/50697>\
**Category:** General\
**Created:** [7 September 2021 06:47 UTC](https://discourse.nodered.org/t/listen-to-all-sub-messages-on-a-mqtt-path/50697 "2021-09-07T06:47:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![novski](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/novski/32/23243_2.png) [@novski](https://discourse.nodered.org/u/novski)\
**Post date:** [7 September 2021 06:47 UTC](https://discourse.nodered.org/t/listen-to-all-sub-messages-on-a-mqtt-path/50697/1 "2021-09-07T06:47:32Z")

</div>

Im wondering if it is possible to set up an MQTT-in node to listen to a root string url, passing all subsequent actions.

sample:  
If i setup my MQTT path as: `/level_1/room_1/lights/ceiling` and configure my MQTT-in node to `/level_1/room_1/` i want to receive all room actions.

Is it possible to subscribe to shortend url's somehow?

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [7 September 2021 06:56 UTC](https://discourse.nodered.org/t/listen-to-all-sub-messages-on-a-mqtt-path/50697/2 "2021-09-07T06:56:33Z")

</div>

Hi @novski

You can use a wildcard subscription to do exactly this.

Subscribe to `/level_1/room_1/#`

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [7 September 2021 07:50 UTC](https://discourse.nodered.org/t/listen-to-all-sub-messages-on-a-mqtt-path/50697/3 "2021-09-07T07:50:53Z")

</div>

Also if you read through this guide it will tell you virtually all you need to know about MQTT. [MQTT Essentials - All Core Concepts explained](https://www.hivemq.com/mqtt-essentials/)

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [7 September 2021 08:01 UTC](https://discourse.nodered.org/t/listen-to-all-sub-messages-on-a-mqtt-path/50697/4 "2021-09-07T08:01:03Z")

</div>

> [@novski](#):
>
> If i setup my MQTT path as: `/level_1/room_1/lights/ceiling`

It is recommended you do not start a topic with a `/`

> **Never use a leading forward slash**
> 
> A leading forward slash is permitted in MQTT. For example, **/myhome/groundfloor/livingroom**. However, the leading forward slash introduces an unnecessary topic level with a zero character at the front. The zero does not provide any benefit and often leads to confusion.

> **[MQTT Topics, Wildcards, & Best Practices – MQTT Essentials: Part 5](https://www.hivemq.com/blog/mqtt-essentials-part-5-mqtt-topics-best-practices/)**
>
> Learn about MQTT Topics, naming conventions, MQTT $SYS topics, MQTT Prefix, MQTT Topic Wildcards, and more in this MQTT Essentials article.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [21 September 2021 08:01 UTC](https://discourse.nodered.org/t/listen-to-all-sub-messages-on-a-mqtt-path/50697/5 "2021-09-21T08:01:09Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
