MQTT in node: subscription to array of topics with MQTT wildcards

According to the documentation of the MQTT in node, the subscription can be an array of strings. So something like [ "abcd/#" , "defg/#" ] as a subscription should be valid.
However if any topic include an MQTT wildcard # or + within an array I have the "you've done something wrong" red triangle on the node.
If I use the dynamic subscription and push the same array using msg.topic (with the action being subscribe) everyone is happy.
Any reason why I can't have such an array directly in the node?

In the help text it says under dynamic subscription


These only apply when the node has been configured for dynamic subscriptions.

So i would read that as you can use an array of string for dynamic subscriptions only.

I get your point the array is described in the dynamic section. So, maybe, that is the intention for the "static" configuration to accept only a single topic...
However, an array without wildcards in the "topic" field works.
So, it is a bit of both :slight_smile:
Array in static works, but no wildcard.

That is not doing what you think.



No, the static input is a single string topic. It is not parsed to be an array or anything except a string. WYSTIWTBITTST (What You Subscribe To Is What The Broker Is Told To Subscribe To)

The reason [ "abcd/#" , "defg/#" ] is shown as invalid is because # must be the last item in a topic path.

So in my example, it is in fact listening to a topic including the opening [ and the closing ] altogether and consider this "array" as one string?

That is correct. you are subscribing to exactly 1 topic - the topic you entered whether that includessquare brackets, commas or not

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.