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

    Class QoSFlowTracker

    Tracks QoS message flows for reliable delivery.

    Maintains separate maps for outbound (client→server) and inbound (server→client) flows. Enforces receive maximum for flow control.

    const tracker = new QoSFlowTracker(65535)

    // Start QoS 1 outbound flow
    tracker.startOutbound(publishPacket, Date.now())

    // Process PUBACK
    const result = tracker.handlePuback(pubackPacket)
    if (result.success) {
    // Flow complete, ID can be released
    }
    Index

    Constructors

    Accessors

    • get inboundCount(): number

      Get current inbound QoS 2 flow count.

      Returns number

    • get outboundCount(): number

      Get current outbound flow count.

      Returns number

    Methods

    • Check if we can send another QoS > 0 message.

      Returns boolean

      true if under receive maximum

    • Get flows that need retry (exceeded timeout).

      Parameters

      • timeout: number

        Retry timeout in milliseconds

      • now: number

        Current timestamp

      Returns OutboundFlow[]

      Array of flows needing retry

    • Handle PUBREC for outbound QoS 2 (step 2).

      Transitions flow from awaiting-pubrec to awaiting-pubcomp.

      Parameters

      • packet: PubrecPacket

        PUBREC packet received

      • timestamp: number

        Timestamp for retry tracking

      Returns AckResult

      Result with updated flow or error

    • Check if we have an inbound QoS 2 flow for a packet ID.

      Used to detect duplicate QoS 2 PUBLISH.

      Parameters

      • packetId: number

      Returns boolean

    • Increment retry count for an outbound flow.

      Parameters

      • packetId: number

        Packet ID to update

      • timestamp: number

        New send timestamp

      Returns OutboundFlow | undefined

      Updated flow or undefined if not found

    • Start tracking an outbound QoS 1 flow.

      Parameters

      • packet: PublishPacket

        PUBLISH packet being sent

      • timestamp: number

        Send timestamp

      Returns void

    • Start tracking an inbound QoS 2 flow.

      Called when we receive a QoS 2 PUBLISH and send PUBREC.

      Parameters

      • packet: PublishPacket

        PUBLISH packet received

      • timestamp: number

        Receive timestamp

      Returns void

    • Start tracking an outbound QoS 2 flow.

      Parameters

      • packet: PublishPacket

        PUBLISH packet being sent

      • timestamp: number

        Send timestamp

      Returns void