HiveMQ

Subscription with Wildcards

Hi guys, sorry for the newbie question, but I’m having a problem with wildcards. I’m trying to subscribe on HiveMQ broker with topic +/# and publishing with the command

mosquitto_pub -h broker.hivemq.com -t sensors/DHT -m “Test from RP HIVEMQ” -d -r

obtaining this result:

$ sudo mosquitto_sub -h broker.hivemq.com -t +/# -d
Client mosq-PdLPJRoLkptWR5tW5D sending CONNECT
Client mosq-PdLPJRoLkptWR5tW5D received CONNACK (0)
Client mosq-PdLPJRoLkptWR5tW5D sending SUBSCRIBE (Mid: 1, Topic: +/#, QoS: 0, Options: 0x00)
Client mosq-PdLPJRoLkptWR5tW5D received SUBACK
Subscribed (mid: 1): 128
Client mosq-PdLPJRoLkptWR5tW5D sending PINGREQ
Client mosq-PdLPJRoLkptWR5tW5D received PINGRESP

But, when I do the same procedure on my local broker, I got the results. There is some kind of block on hiveMQ for this kind of subscription with wildcards?

Thanks in advance!

Hi @brunojesus,

our public HiveMQ broker (broker.hivemq.com) doesn’t allow any kind of “full wildcard”.
You can subscribe to “test/#” but not to “+/#”.

You should not have this problem with your local broker.

Greetings,
Michael from the HiveMQ team

1 Like

Hi brunojesus,

Your client tells you that the subscribe failed by the returncode “128” (Unspecified Error).
If the subscribe was successful then the returncode would return 0,1 or 2 depending on the granted QoS level.