I've just had a bug reported against mosquitto (
https://bugs.launchpad.net/mosquitto/+bug/901697 ) where when a
subscription to something/# exists and a message is published to
something/ then mosquitto crashes. Obviously crashing is the incorrect
behaviour, but aside from that I'm not sure how to treat that topic. I
think my options are:
* Treat topics ending in / as invalid and silently swallow
subscriptions and messages that use them
* Treat topics ending in / as not ending in / - ie removing the final slash.
* Treat topics ending in / as having a zero length final level of
hierarchy, so a message published to something/ would go to
subscriptions at something/ something/# something/+ but not something
Any suggestions?
My own choice would be to define topics ending in / as invalid in the spec.
Cheers,
Roger
While the difference between A/# and A/+ may appear inconsistent, it
is consistent with how the two wildcard characters are defined:
# matches zero or more levels
+ matches exactly one level
Ultimately, topics are arbitrary strings upon which we have said the
'/' has an additional meaning. There is currently no such thing as an
invalid topic (assuming it is valid UTF etc) (even an empty string is
a valid topic - although whether that should be the case is a separate
discussion) (of course it shouldn't contain wildcards unless it is in
the context of a subscription) (any more caveats?) (nope).
MQTT v3 only has positive acknowledgements, it would not be possible
to inform a client it had sent an invalid topic - so as you say we
would have to silently swallow them or kick the client off.
Removing the A/==A equivalence would mean you wouldn't be able to
subscribe to A and all of its sub-topics in a single subscription
request (A/# as above).
Cheers,
Nick
> --
> To learn more about MQTT please visit http://mqtt.org
>
> To post to this group, send email to mq...@googlegroups.com
> To unsubscribe from this group, send email to
> mqtt+uns...@googlegroups.com
>
> For more options, visit this group at
> http://groups.google.com/group/mqtt
> - a topic ending in a slash is considered equivalent to the same
> topic without the slash, which enables the wildcards to behave like
> this:
This is a subtly different description to the one in the spec. If you
know the above, the spec makes more sense but without it there's room
for confusion (obviously - I got it wrong). The way I read the spec up
til now was that A/# matching A was more a feature of the # wildcard
than the way the hierarchy separator works. It makes more sense now,
thanks.
Cheers,
Roger
> --
> To learn more about MQTT please visit http://mqtt.org
>
> To post to this group, send email to mq...@googlegroups.com
> To unsubscribe from this group, send email to
> mqtt+uns...@googlegroups.com
>
> For more options, visit this group at
> http://groups.google.com/group/mqtt
--
Andy Piper | Farnborough, Hampshire (UK)
blog: http://andypiper.co.uk | skype: andypiperuk
twitter: @andypiper | images: http://www.flickr.com/photos/andypiper
Could we expand the handling of topics to include regular expressions?
Or '?' to allow omission of single characters?
On Dec 9, 3:14 pm, "andypipe...@gmail.com" <andypipe...@gmail.com>
wrote:
> Worth getting this into the wiki on mqtt.org for future reference
> maybe? Doesn't mean it wouldn't be open to future discussion or
> modification as the spec goes to standards, but at least we can have
> it written down somewhere :-)
>
>
>
>
>
>
>
>
>
> On Thu, Dec 8, 2011 at 16:54, Roger Light <ro...@atchoo.org> wrote:
> > On Thu, Dec 8, 2011 at 4:15 PM, Nicholas O'Leary <nick.ole...@gmail.com> wrote:
>
> >> - a topic ending in a slash is considered equivalent to the same
> >> topic without the slash, which enables the wildcards to behave like
> >> this:
>
> > This is a subtly different description to the one in the spec. If you
> > know the above, the spec makes more sense but without it there's room
> > for confusion (obviously - I got it wrong). The way I read the spec up
> > til now was that A/# matching A was more a feature of the # wildcard
> > than the way the hierarchy separator works. It makes more sense now,
> > thanks.
>
> > Cheers,
>
> > Roger
>
> > --
> > To learn more about MQTT please visithttp://mqtt.org