Make MQTT wildcard subscriptions possible
I need wildcard subscriptions for a project but I'm happy with just filtering the topics myself.
So here is a "minimal effort"-solution, at least as a discussion starter.
It only works with the binary_multipart_messages
as they are the lowest-level end of subscribing atm.
The solution is as following: On every message we look if there are any handlers with topics containing a wildcard registered. Each of them gets the message and they have to match the topics on their own.
This:
- doesn't impede the regular handlers like our OTA handler
- doesn't break anything else as wildcard handlers won't ever be called atm because you can't publish messages with wildcards in their topics
Other solutions are:
- implement a full-blown topic matching algorithm and despatch the messages correctly like
paho-mqtt
does on bigger computers
Edited by fxk8y