import type { CodecOpts, PacketId, QoS, TopicFilter } from "./types.ts"; import type { ProtocolLevelNoV5 } from "./protocolLevels.ts"; import type { SubscribeProperties } from "./Properties.ts"; import type { RetainHandling } from "./RetainHandling.ts"; import { PacketType } from "./PacketType.ts"; /** * Represents an MQTT SUBSCRIBE packet conforming to MQTT version 3.1.1 (Protocol Level 4) or lower. */ export type SubscribePacketV4 = { /** The type of the MQTT control packet. */ type: PacketType; /** The protocol version level, restricted to non-v5 variants. */ protocolLevel: ProtocolLevelNoV5; /** The unique 16-bit packet identifier. */ id: PacketId; /** The list of topic subscriptions associated with this packet. */ subscriptions: Array; }; /** * Represents an MQTT SUBSCRIBE packet conforming to MQTT version 5.0. */ export type SubscribePacketV5 = { /** The type of the MQTT control packet. */ type: PacketType; /** The protocol version level, strictly set to 5. */ protocolLevel: 5; /** The unique 16-bit packet identifier. */ id: PacketId; /** Optional user and protocol properties introduced in MQTT v5. */ properties?: SubscribeProperties; /** The list of topic subscriptions including v5 option flags. */ subscriptions: Array; }; /** * Represents a union of available MQTT SUBSCRIBE packets (v4 or v5) sent from client to server. */ export type SubscribePacket = SubscribePacketV4 | SubscribePacketV5; /** * Describes a topic subscription requirement for MQTT version 3.1.1. */ export type SubscriptionV4 = { /** The topic filter expression the client intends to subscribe to. */ topicFilter: TopicFilter; /** The maximum Quality of Service level authorized for this topic filter. */ qos: QoS; }; /** * Describes a topic subscription requirement for MQTT version 5.0, including extended flags. */ export type SubscriptionV5 = { /** The topic filter expression the client intends to subscribe to. */ topicFilter: TopicFilter; /** The maximum Quality of Service level authorized for this topic filter. */ qos: QoS; /** Optional flag indicating whether messages should not be forwarded back to the client that published them. */ noLocal?: boolean; /** Optional flag indicating whether messages forwarded under this subscription keep their original retain flag. */ retainAsPublished?: boolean; /** Optional setting declaring how retained messages are handled when the subscription is created. */ retainHandling?: RetainHandling; }; /** * Represents a generic union of MQTT subscription configurations (v4 or v5). */ export type Subscription = SubscriptionV4 | SubscriptionV5; /** * Codec utility object responsible for encoding and decoding MQTT SUBSCRIBE control packets. */ export declare function encode(packet: SubscribePacket, codecOpts: CodecOpts): Uint8Array; export declare function decode(buffer: Uint8Array, flags: number, codecOpts: CodecOpts, packetType: PacketType): SubscribePacket; //# sourceMappingURL=subscribe.d.ts.map