UNPKG

@seriousme/opifex

Version:

MQTT client & server for Deno & NodeJS

19 lines (17 loc) 674 B
import type { Context } from "../context.ts"; import type { UnsubackPacket } from "../deps.ts"; /** * Handles the UNSUBACK packet received from the server * @param ctx - The MQTT client context * @param packet - The UNSUBACK packet received from the server * @description * The UNSUBACK Packet is sent by the Server to the Client to confirm receipt of * an UNSUBSCRIBE Packet. * When received, it removes the pending outgoing request and completes the corresponding * unsubscribe operation. */ export function handleUnsuback(ctx: Context, packet: UnsubackPacket): void { const id = packet.id; ctx.store.pendingOutgoing.delete(id); ctx.receiveUnsuback(id); }