Use the '+' wildcard for MQTT rather than '#' #4528
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This means we'll then be subscribing only to topics one nesting level deep, rather than any amount of nesting through the end of the topic, as
#
does.Discussed briefly with some of y'all firmware devs but I believe this should be fine and limit what messages are getting sent to firmware a little bit. We're not publishing anything deeper than e.g.
msh/2/e/ChannelName/!12345678
, meaningmsh/2/e/ChannelName/+
will pick that up. Without this change, you could for example set your root topic tomsh/2/e/ChannelName
, which would then publish messages tomsh/2/e/ChannelName/2/e/DifferentChannelName/!abcdef01
and it would go to clients with justmsh
configured as the prefix and a downlink on theChannelName
channel.I think that there's another improvement to be made in that we should probably only be subscribing to the json topic if and when the channel name is equal to
mqtt
, rather than subscribing to it on every channel and then throwing out everything that's not on themqtt
topic. But comparing strings in C++ is a project for a different day, for me :)