← Back to team overview

mosquitto-users team mailing list archive

Re: Wildcard and retained messages

 

Hi Stefano,

That's definitely a bug. I think the first publish to /sensor/001
should match with a subscription of # (so the second mosquitto_sub is
correct) but I'd have to check.

Cheers,

Roger


On Thu, Sep 20, 2012 at 2:39 PM, stefano costa
<stefano.costa@xxxxxxxxxxx> wrote:
> Hello, I'm not sure if this is a bug or intentional.
>
> On first side:
> mosquitto_sub -v -h brokerhost -t "#"
>
> On second side:
> mosquitto_pub -r -h brokerhost -t "sensor/001" -m "9912"  <== this message
> is shown on first side
> mosquitto_pub -r -h brokerhost -t "/sensor/001" -m "9912"  <== this message
> is NOT shown on first side due to the leading "/" in topic
>
> Up to this, it's correct. But please note that the two messages are sent
> with "retained" set, and so if I launch again:
> mosquitto_sub -v -h brokerhost -t "#"
>
> now I get both retained messages:
> /sensor/001 9912  <=== this could be an error?
> sensor/001 9912
>
> while if I launch:
> mosquitto_sub -v -h brokerhost -t "/#" (note the "/#" instead of "#")
>
> what I get is only one retained message:
> /sensor/001 9912
>
>
> Thanks S
>
> --
>   Stefano Costa, R&D Manager
>   M +39 335 6565749
>   Skype stefanocosta.bluewind
>   http://www.bluewind.it/stefanoco?code=18
>
>
> --
> Mailing list: https://launchpad.net/~mosquitto-users
> Post to     : mosquitto-users@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~mosquitto-users
> More help   : https://help.launchpad.net/ListHelp
>


References