forked from nestjs/nest
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmqtt-options.interface.ts
More file actions
137 lines (135 loc) · 2.77 KB
/
Copy pathmqtt-options.interface.ts
File metadata and controls
137 lines (135 loc) · 2.77 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
/**
* @see https://github.com/mqttjs/MQTT.js/
*/
export declare type QoS = 0 | 1 | 2;
export interface MqttClientOptions extends ISecureClientOptions {
port?: number; // port is made into a number subsequently
host?: string; // host does NOT include port
hostname?: string;
path?: string;
protocol?: 'wss' | 'ws' | 'mqtt' | 'mqtts' | 'tcp' | 'ssl' | 'wx' | 'wxs';
wsOptions?: {
[x: string]: any;
};
/**
* 10 seconds, set to 0 to disable
*/
keepalive?: number;
/**
* 'mqttjs_' + Math.random().toString(16).substr(2, 8)
*/
clientId?: string;
/**
* 'MQTT'
*/
protocolId?: string;
/**
* 4
*/
protocolVersion?: number;
/**
* true, set to false to receive QoS 1 and 2 messages while offline
*/
clean?: boolean;
/**
* 1000 milliseconds, interval between two reconnections
*/
reconnectPeriod?: number;
/**
* 30 * 1000 milliseconds, time to wait before a CONNACK is received
*/
connectTimeout?: number;
/**
* the username required by your broker, if any
*/
username?: string;
/**
* the password required by your broker, if any
*/
password?: string;
/**
* a any for the incoming packets
*/
incomingStore?: any;
/**
* a any for the outgoing packets
*/
outgoingStore?: any;
queueQoSZero?: boolean;
reschedulePings?: boolean;
servers?: Array<{
host: string;
port: number;
}>;
/**
* true, set to false to disable re-subscribe functionality
*/
resubscribe?: boolean;
/**
* a message that will sent by the broker automatically when the client disconnect badly.
*/
will?: {
/**
* the topic to publish
*/
topic: string;
/**
* the message to publish
*/
payload: string;
/**
* the QoS
*/
qos: QoS;
/**
* the retain flag
*/
retain: boolean;
};
transformWsUrl?: (url: string, options: any, client: any) => string;
}
export interface ISecureClientOptions {
/**
* optional private keys in PEM format
*/
key?: string | string[] | Buffer | Buffer[] | Record<string, any>[];
/**
* optional cert chains in PEM format
*/
cert?: string | string[] | Buffer | Buffer[];
/**
* Optionally override the trusted CA certificates in PEM format
*/
ca?: string | string[] | Buffer | Buffer[];
rejectUnauthorized?: boolean;
}
export interface IClientPublishOptions {
/**
* the QoS
*/
qos: QoS;
/**
* the retain flag
*/
retain?: boolean;
/**
* whether or not mark a message as duplicate
*/
dup?: boolean;
}
export interface IClientSubscribeOptions {
/**
* the QoS
*/
qos: QoS;
}
export interface IClientReconnectOptions {
/**
* a any for the incoming packets
*/
incomingStore?: any;
/**
* a any for the outgoing packets
*/
outgoingStore?: any;
}