halfgaar / FlashMQ

FlashMQ is a fast light-weight MQTT broker/server, designed to take good advantage of multi-CPU environments
https://www.flashmq.org/
Open Software License 3.0
173 stars 24 forks source link

Multi-level wildcard out of spec #61

Closed slavslavov closed 10 months ago

slavslavov commented 10 months ago

The non-normative comment in the MQTT v5 standard, point 4.7.1.2 says:

Client subscribes to “sport/tennis/player1/#”, it would receive messages published using these Topic Names: · “sport/tennis/player1” · “sport/tennis/player1/ranking · “sport/tennis/player1/score/wimbledon”

When I subscribe with a mosquitto client: mosquitto_sub -t "sport/tennis/player1/#" -v

and publish: mosquitto_pub -t "sport/tennis/player1" -m "hello"

I don't get the message. Publishing the other two of the examples is OK.

A potential fix may be to add the following after the while loop in topicsMatch

    if (subscribe_itr != subscribe_itr.end() && *subscribe_itr == "#")
    {
        return true;
    }
halfgaar commented 10 months ago

Fixed in master. Are you able to build and test?

Release coming tonight, probably.

slavslavov commented 10 months ago

Yes, tested master. It works now as expected.

halfgaar commented 10 months ago

In case you were wondering how I was so fast, I just found this yesterday :)

slavslavov commented 10 months ago

I saw the commit history when I pulled master and I saw a commit from yesterday. :+1:

halfgaar commented 10 months ago

Version 1.6.1 with fix released.