← Back to team overview

mosquitto-users team mailing list archive

Re: Wild card

 

On 06/03/2013 01:08 PM, Roger Light wrote:
Hi Stefano,

The behaviour you describe is incorrect. It is better explained using
a longer topic - let's set sensors/temperature sensors/humidity etc.

A subscription to sensors/# would match on sensors/temperature,
sensors/humidity *and* sensors. If we imagine that a subscription to
/# is actually a subscription to ""/# (i.e. an empty topic followed by
/ followed by #) then a subscription to /# should match against "" as
well as anything below it such as /foo/bar (""/foo/bar). A
subscription to # on the other hand will match everything, including
""/foo/bar.

The slightly confounding bit is that topics must be at least one
character long, so it is not possible to publish to "", which would
match against ""/#.

The current mosquitto code (you really should upgrade) works correctly
for subscriptions to # but not for retained messages when subscribing
to /# (it returns messages with topics without a leading slash). I'll
get that fixed.


Thanks a lot Roger now I can explain what I see. We will also upgrade our brokers and client in the meantime!
S


--
  Stefano Costa, R&D Manager
  M +39 335 6565749
  Skype stefanocosta.bluewind
  Twitter @stefanobluewind
  http://www.bluewind.it


References