forked from selaromdotnet/nativescript-mqtt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
41 lines (35 loc) · 833 Bytes
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
declare function require(string);
declare class MQTT {}
declare interface IEvent<T>{
on(handler:any) : T;
off(handler:any) : T;
}
declare class EventHandler<T> {
on(handler?:T):void;
off(handler?:T): void;
trigger(data?: T): void;
}
declare class Message {
payload: string;
bytes: ArrayBuffer;
topic: string;
qos: number;
retained: boolean;
}
declare class MQTTClient {
constructor(clientOptions:any);
connect(username?:string, password?:string):void;
onConnectionSuccess(): IEvent<void>;
onConnectionFailure(): IEvent<string>;
onConnectionLost(): IEvent<string>;
onMessageArrived(): IEvent<Message>;
connected: boolean;
}
declare interface ClientOptions {
host? : string,
port? : number,
useSSL? : boolean,
path? : string,
clientId? : string,
retryOnDisconnect? : boolean
}