@qualithm/mqtt-wire - v0.1.5
    Preparing search index...

    Function topicMatches

    • Matches a topic name against a topic filter.

      Supports MQTT wildcards:

      • + matches exactly one level
      • # matches zero or more levels (must be last)

      Parameters

      • topicName: string

        The topic name (from PUBLISH)

      • topicFilter: string

        The topic filter (from SUBSCRIBE)

      Returns boolean

      true if the topic matches the filter

      topicMatches("sport/tennis/player1", "sport/tennis/+") // true
      topicMatches("sport/tennis/player1", "sport/#") // true
      topicMatches("sport/tennis", "sport/tennis/#") // true
      topicMatches("sport", "sport/#") // true

      MQTT 5.0 ยง4.7.2