LabVIEW-Open-Source/LV-MQTT-Broker

Are wildcards supported when you subscribe to a topic?

russellgsystems opened this issue · 5 comments

For example can I subscribe to a topic called topic1/#? where # is the wildcard. If not can you please point me to where I might need to change the code to support it?

Hi @russellgsystems ,

There is partial support for wildcards.
The example you displayed is supported. The hash tag is a wildcard that can also be used with more complex level filters. Not all those are currently supported, for example topic1/#/state. At the moment, the hashtag must be at the end of the topic hierarchy.

The + wildcard support is not done at all, if I remember correctly.

I'm on vacation and don't have access to the code, but there is a subscription class that depends on a topicFilter class. That's where you'll want to poke into is you need to expand the feature...

Hello @francois-normandin,

Thanks for the quick response. That is great news! Currently I plan to use the wildcard at the end of the topic hierarchy so we should be good for now.

Have a great vacation!

Thanks again,

Russell

Hello @francois-normandin,

A colleague of mine pointed out that ‘#’’ is ONLY valid at the end.

image

You're right. It's the + that can be at any level.

topic1/+/state

It seems I finished both wildcards. I admit I don't remember doing the "+"... 😁
You can take a look at the unit tests of requirements 4.7.1 as documented in issues #122 and #123 .