UNPKG

1.58 kBTypeScriptView Raw
1/// <reference types="node" />
2import { Transport } from '../enums';
3import { MqttClient } from '../external/mqtt-client.interface';
4import { CustomTransportStrategy, MessageHandler, PacketId, ReadPacket } from '../interfaces';
5import { MqttOptions } from '../interfaces/microservice-configuration.interface';
6import { Server } from './server';
7export declare class ServerMqtt extends Server implements CustomTransportStrategy {
8 private readonly options;
9 readonly transportId = Transport.MQTT;
10 protected mqttClient: MqttClient;
11 private readonly url;
12 constructor(options: MqttOptions['options']);
13 listen(callback: (err?: unknown, ...optionalParams: unknown[]) => void): Promise<void>;
14 start(callback: (err?: unknown, ...optionalParams: unknown[]) => void): void;
15 bindEvents(mqttClient: MqttClient): void;
16 close(): void;
17 createMqttClient(): MqttClient;
18 getMessageHandler(pub: MqttClient): Function;
19 handleMessage(channel: string, buffer: Buffer, pub: MqttClient, originalPacket?: Record<string, any>): Promise<any>;
20 getPublisher(client: MqttClient, pattern: any, id: string): any;
21 parseMessage(content: any): ReadPacket & PacketId;
22 matchMqttPattern(pattern: string, topic: string): boolean;
23 getHandlerByPattern(pattern: string): MessageHandler | null;
24 removeHandlerKeySharedPrefix(handlerKey: string): string;
25 getRequestPattern(pattern: string): string;
26 getReplyPattern(pattern: string): string;
27 handleError(stream: any): void;
28 protected initializeSerializer(options: MqttOptions['options']): void;
29}