1 | import { Observable } from 'rxjs';
|
2 | import { PubSubContent, PubSubContentObserver, PubSubOptions, PublishInput, SubscribeInput } from '../types/PubSub';
|
3 | import { AbstractPubSub } from './PubSub';
|
4 | export declare function mqttTopicMatch(filter: string, topic: string): boolean;
|
5 | export interface MqttOptions extends PubSubOptions {
|
6 | clientId?: string;
|
7 | url?: string;
|
8 | endpoint?: string;
|
9 | }
|
10 | interface PahoClient {
|
11 | onMessageArrived(params: {
|
12 | destinationName: string;
|
13 | payloadString: string;
|
14 | }): void;
|
15 | onConnectionLost(params: {
|
16 | errorCode: number;
|
17 | }): void;
|
18 | connect(params: Record<string, string | number | boolean | (() => void)>): void;
|
19 | disconnect(): void;
|
20 | isConnected(): boolean;
|
21 | subscribe(topic: string): void;
|
22 | unsubscribe(topic: string): void;
|
23 | send(topic: string, message: string): void;
|
24 | }
|
25 | declare class ClientsQueue {
|
26 | private promises;
|
27 | get(clientId: string, clientFactory?: (input: string) => Promise<PahoClient | undefined>): Promise<PahoClient | undefined>;
|
28 | get allClients(): string[];
|
29 | remove(clientId: string): void;
|
30 | }
|
31 | export declare class MqttOverWS extends AbstractPubSub<MqttOptions> {
|
32 | private _clientsQueue;
|
33 | private connectionState?;
|
34 | private readonly connectionStateMonitor;
|
35 | private readonly reconnectionMonitor;
|
36 | constructor(options?: MqttOptions);
|
37 | protected get clientId(): string;
|
38 | protected get endpoint(): Promise<string | undefined>;
|
39 | protected get clientsQueue(): ClientsQueue;
|
40 | protected get isSSLEnabled(): boolean;
|
41 | onDisconnect({ clientId, errorCode, ...args }: {
|
42 | clientId?: string;
|
43 | errorCode?: number;
|
44 | }): void;
|
45 | newClient({ url, clientId }: MqttOptions): Promise<PahoClient>;
|
46 | protected connect(clientId: string, options?: MqttOptions): Promise<PahoClient | undefined>;
|
47 | protected disconnect(clientId: string): Promise<void>;
|
48 | publish({ topics, message }: PublishInput): Promise<void>;
|
49 | protected _topicObservers: Map<string, Set<PubSubContentObserver>>;
|
50 | protected _clientIdObservers: Map<string, Set<PubSubContentObserver>>;
|
51 | private _onMessage;
|
52 | subscribe({ topics, options, }: SubscribeInput & {
|
53 | options?: MqttOptions;
|
54 | }): Observable<PubSubContent>;
|
55 | }
|
56 | export {};
|
57 |
|
\ | No newline at end of file |