--
To learn more about MQTT please visit http://mqtt.org
---
You received this message because you are subscribed to the Google Groups "MQTT" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mqtt+unsubscribe@googlegroups.com.
To post to this group, send email to mq...@googlegroups.com.
Visit this group at https://groups.google.com/group/mqtt.
For more options, visit https://groups.google.com/d/optout.
--
To unsubscribe from this group and stop receiving emails from it, send an email to mqtt+uns...@googlegroups.com.
+
can be used as a wildcard for a single level of hierarchy. It could be used with the topic above to get information on all computers and hard drives as follows:
sensors/+/temperature/+
As another example, for a topic of "a/b/c/d", the following example subscriptions will match:
a/b/c/d
+/b/c/d
a/+/c/d
a/+/+/d
+/+/+/+
The following subscriptions will not match:
a/b/c
b/+/c/d
+/+/+
#
can be used as a wildcard for all remaining levels of hierarchy. This means that it must be the final character in a subscription. With a topic of "a/b/c/d", the following example subscriptions will match:
a/b/c/d
#
a/#
a/b/#
a/b/c/#
+/b/c/#
Zero length topic levels are valid, which can lead to some slightly non-obvious behaviour. For example, a topic of "a//topic" would correctly match against a subscription of "a/+/topic". Likewise, zero length topic levels can exist at both the beginning and the end of a topic string, so "/a/topic" would match against a subscription of "+/a/topic", "#" or "/#", and a topic "a/topic/" would match against a subscription of "a/topic/+" or "a/topic/#".
@eric/paulas @ranjith said, it’s to do with complexity of implementation of the topic matcher in the broker.If you allow an arbitrary number of clauses (slash-delimited sections) to match in the middle of a topic, and then have to match some others at the end, then you have to pretty much implement a regex parser (with backtracking and stuff), which we really didn’t want to force on anyone implementing a lean, mean, high-scale broker.@John, no, a + is a *single* level wild card. You can only have a # at the end for ‘the rest of the sub-tree.@ranjith careful - you can’t *control* things with a wildcard - + and # are for subscriptions for receiving a range of topics (e.g. all the air conditioners). You have to give an explicit topic name in a publish message.Andy
On 21 Jul 2017, at 12:06, Paul Fremantle <paul.fr...@port.ac.uk> wrote:
EricI'm not sure of the answer. Maybe Andy SC can jump in. I think it was probably designed that way so that small broker implementations like RSMB could process it efficiently.Paul
On 21 July 2017 at 05:18, Eric Tsai <ericm...@gmail.com> wrote:
I sometimes think it would be useful to have multi-level wild cards in the middle, or maybe have multiple multi-level wild cards. I know MQTT doesn't allow this, that the '#' has to be at the end of the subscription topic string. Why does MQTT constrain the use of the # wild card like this?
Thanks,
Eric
--
To learn more about MQTT please visit http://mqtt.org
---
You received this message because you are subscribed to the Google Groups "MQTT" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mqtt+uns...@googlegroups.com.
To post to this group, send email to mq...@googlegroups.com.
Visit this group at https://groups.google.com/group/mqtt.
For more options, visit https://groups.google.com/d/optout.
--Paul FremantleDoctoral Researcher, University of Portsmouth, School of ComputingVisiting Scientist, Institute of the Architecture of Application Systems, StuttgartVisiting Lecturer, Software Engineering Programme, Oxford UniversityCo-Founder, WSO2
Apache Member and Committertwitter: pzfreo / skype: paulfremantle / blog: http://pzf.fremantle.org
To unsubscribe from this group and stop receiving emails from it, send an email to mqtt+uns...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to mqtt+unsubscribe@googlegroups.com.
To post to this group, send email to mq...@googlegroups.com.
Visit this group at https://groups.google.com/group/mqtt.
For more options, visit https://groups.google.com/d/optout.
--
To learn more about MQTT please visit http://mqtt.org
---
You received this message because you are subscribed to the Google Groups "MQTT" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mqtt+unsubscribe@googlegroups.com.