UNPKG

1.57 kBTypeScriptView Raw
1/// <reference types="node" />
2import { Logger } from '@nestjs/common/services/logger.service';
3import { Observable } from 'rxjs';
4import { MqttClient } from '../external/mqtt-client.interface';
5import { MqttOptions, ReadPacket, WritePacket } from '../interfaces';
6import { MqttRecordOptions } from '../record-builders/mqtt.record-builder';
7import { ClientProxy } from './client-proxy';
8/**
9 * @publicApi
10 */
11export declare class ClientMqtt extends ClientProxy {
12 protected readonly options: MqttOptions['options'];
13 protected readonly logger: Logger;
14 protected readonly subscriptionsCount: Map<string, number>;
15 protected readonly url: string;
16 protected mqttClient: MqttClient;
17 protected connection: Promise<any>;
18 constructor(options: MqttOptions['options']);
19 getRequestPattern(pattern: string): string;
20 getResponsePattern(pattern: string): string;
21 close(): void;
22 connect(): Promise<any>;
23 mergeCloseEvent<T = any>(instance: MqttClient, source$: Observable<T>): Observable<T>;
24 createClient(): MqttClient;
25 handleError(client: MqttClient): void;
26 createResponseCallback(): (channel: string, buffer: Buffer) => any;
27 protected publish(partialPacket: ReadPacket, callback: (packet: WritePacket) => any): () => void;
28 protected dispatchEvent(packet: ReadPacket): Promise<any>;
29 protected unsubscribeFromChannel(channel: string): void;
30 protected initializeSerializer(options: MqttOptions['options']): void;
31 protected mergePacketOptions(requestOptions?: MqttRecordOptions): MqttRecordOptions | undefined;
32}