UNPKG

1.8 kBTypeScriptView Raw
1import Observable from 'zen-observable-ts';
2import { AbstractPubSubProvider } from './PubSubProvider';
3import { SubscriptionObserver } from '../types/PubSub';
4import { ProviderOptions } from '../types/Provider';
5export declare function mqttTopicMatch(filter: string, topic: string): boolean;
6export interface MqttProviderOptions extends ProviderOptions {
7 clientId?: string;
8 url?: string;
9}
10declare class ClientsQueue {
11 private promises;
12 get(clientId: string, clientFactory?: (input: string) => Promise<any>): Promise<any>;
13 get allClients(): string[];
14 remove(clientId: string): void;
15}
16export declare class MqttOverWSProvider extends AbstractPubSubProvider {
17 private _clientsQueue;
18 private connectionState;
19 private readonly connectionStateMonitor;
20 private readonly reconnectionMonitor;
21 constructor(options?: MqttProviderOptions);
22 protected get clientId(): any;
23 protected get endpoint(): any;
24 protected get clientsQueue(): ClientsQueue;
25 protected get isSSLEnabled(): boolean;
26 protected getTopicForValue(value: any): any;
27 getProviderName(): string;
28 onDisconnect({ clientId, errorCode, ...args }: {
29 clientId?: string;
30 errorCode?: number;
31 }): void;
32 newClient({ url, clientId }: MqttProviderOptions): Promise<any>;
33 protected connect(clientId: string, options?: MqttProviderOptions): Promise<any>;
34 protected disconnect(clientId: string): Promise<void>;
35 publish(topics: string[] | string, msg: any): Promise<void>;
36 protected _topicObservers: Map<string, Set<SubscriptionObserver<any>>>;
37 protected _clientIdObservers: Map<string, Set<SubscriptionObserver<any>>>;
38 private _onMessage;
39 subscribe(topics: string[] | string, options?: MqttProviderOptions): Observable<any>;
40}
41export {};