Link Search Menu Expand Document

arena-py API v1.0.1

arena.utils.mqtt

class MQTTMatcher:

Intended to manage topic filters including wildcards.

Internally, MQTTMatcher use a prefix tree (trie) to store values associated with filters, and has an iter_match() method to iterate efficiently over all filters that match some topic name.

def iter_match(self, topic):

Return an iterator on all values associated with filters that match the :topic

class MQTTMatcher.Node:
def topic_matches_sub(sub: str, topic: str) -> bool:

Check whether a topic matches a subscription.

For example:

  • Topic "foo/bar" would match the subscription "foo/#" or "+/bar"
  • Topic "non/matching" would not match the subscription "non/+/+"