Mqtt subscription - No notify with topic subscription, using '+' and '#' together
Unsolved
General and Desktop
-
We noticed that when we try to send a topic via MQTT in our QT (6.5.2) quick application, we get an error using Multi-level wildcard ('#'), and Single-level wildcard ('+'), both in the same topic.
Example:
if our app subscribes this topic:"persint/1/+/msa/#"
and via MQTT Explorer we publish:
"persint/1/2/msa/3"
the app is not notified.
How to fix it?
This is the link of MQTT doc:
https://docs.oasis-open.org/mqtt/mqtt/v5.0/mqtt-v5.0.pdf
and this is an app example with relative output:
QMqttTopicFilter globalFilter{"foo/+/#"}; QMqttTopicName topicName("foo/pippo/bar"); if(globalFilter.isValid()) { qDebug() << "FILTER VALID"; if (globalFilter.match(topicName)) { qDebug() << "TOPIC MATCH"; } else { qDebug() << "TOPIC NO MATCH"; } } else { qDebug() << "FILTER NOT VALID"; }
and the output is:
FILTER VALID TOPIC NO MATCH
-
Hi @nicolobracchi40, and welcome!
This looks like a bug. See https://bugreports.qt.io/browse/QTBUG-104478