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

    Class TopicAliasMap

    Manages topic aliases for one direction (either client→server or server→client).

    Each endpoint maintains its own alias mappings. The maximum alias value is negotiated during connection.

    // Server advertises topicAliasMaximum: 10 in CONNACK
    const outbound = new TopicAliasMap(10)

    // Client can assign aliases 1-10 when publishing
    outbound.set(1, "sensor/temperature")
    const topic = outbound.get(1) // "sensor/temperature"
    Index

    Constructors

    Accessors

    Methods

    Constructors

    Accessors

    Methods

    • Delete a topic alias mapping.

      Parameters

      • alias: number

        Alias value to delete

      Returns boolean

      true if mapping existed

    • Get the topic for an alias.

      Parameters

      • alias: number

        Alias value to look up

      Returns string | undefined

      Topic name or undefined if not set

    • Check if an alias has a mapping.

      Parameters

      • alias: number

        Alias value to check

      Returns boolean

      true if alias is mapped

    • Check if an alias is valid (within range).

      Parameters

      • alias: number

        Alias value to check

      Returns boolean

      true if alias is valid

    • Set a topic alias mapping.

      Parameters

      • alias: number

        Alias value (1 to maximum)

      • topic: string

        Topic name to associate

      Returns void

      TopicAliasError if alias is out of range or aliases disabled