← Back to team overview

mqtt-users team mailing list archive

Re: Subscribing to a wildcard topic, feedback about topic path

 

Hi Stefano,

> I subscribe to a set of topics using wildcards:
>
> bluewind@broker:~$ mosquitto_sub -h localhost -t /#
>
> then I publish some data on a specific topic under that:
>
> stefanoco@stefanocopc:~$ mosquitto_pub -h broker -t /stefanoco/test -m
> "Hello"
>
> The message is shown as "Hello" at the subscriber's side, but no indication
> about the topic under it was published under is available, or am I wrong?
> Isn't this a limitation?

mosquitto_sub has the "-v" option which displays message topics. In
the general case an MQTT client always knows which topic any message
comes in on and if you are developing your own client you will be
given this information through whatever mechanism the client library
passes you the message itself.

libmosquitto tells you the message topic, QoS level, retained state
and the message data itself. I'm sure all other libraries do the same.

Cheers,

Roger


References