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

    Type Alias OnPublishHook

    OnPublishHook: (
        packet: PublishPacket,
        context: HookContext,
    ) => void | PublishOutcome | Promise<void | PublishOutcome>

    Hook called when client sends PUBLISH.

    QoS acknowledgements (PUBACK, PUBREC) are handled automatically. With pubackAfterDelivery, a QoS 1 PUBACK waits for this hook: a hook that throws withholds it and ends the session, and a returned PublishOutcome sets its reason code. MQTT 3.1.1 has no PUBACK reason code, so there a failure outcome withholds the PUBACK like a throw. Outside pubackAfterDelivery, and for QoS 0 and 2, a returned outcome is ignored. The packet's topic is already resolved from topic alias if applicable.

    Type Declaration