UNPKG

nxkit

Version:

This is a collection of tools, independent of any other libraries

65 lines (64 loc) 1.54 kB
/// <reference types="node" /> import { EventEmitter as EE } from 'events'; export declare class Packet { cmd?: string; retain?: boolean; qos?: number; dup?: boolean; topic?: string | Buffer; payload?: string | Buffer; messageId?: number; length?: number; protocolId?: string | Buffer; protocolVersion?: number; will?: { topic: string; payload: string | Buffer; retain?: Boolean; qos?: number; }; clean?: boolean; keepalive?: number; clientId?: string; username?: string; password?: string | Buffer; sessionPresent?: boolean; returnCode?: number; subscriptions?: { topic: string; qos: number; }[]; unsubscriptions?: string[]; granted?: number[]; } declare class PacketIMPL extends Packet { length: number; qos: number; } export default class Parser extends EE { private _states; private _list; private _stateCounter; private _pos; packet: PacketIMPL; error: Error | null; private _resetState; parse(buf: Buffer): number; private _parseHeader; private _parseLength; private _parsePayload; private _parseConnect; private _parseConnack; private _parsePublish; private _parseSubscribe; private _parseSuback; private _parseUnsubscribe; private _parseUnsuback; private _parseMessageId; private _parseString; private _parseBuffer; private _parseNum; private _newPacket; private _emitError; } export {};