@ray-js/wechat-mqtt 0.1.1 → 0.1.2-beta-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/src/index.d.ts +0 -5
- package/src/lib/auth.d.ts +0 -3
- package/src/lib/connect.d.ts +0 -5
- package/src/lib/constant.d.ts +0 -6
- package/src/lib/disconnect.d.ts +0 -5
- package/src/lib/factory.d.ts +0 -11
- package/src/lib/interface.d.ts +0 -216
- package/src/lib/packet.d.ts +0 -22
- package/src/lib/parse.d.ts +0 -17
- package/src/lib/ping.d.ts +0 -3
- package/src/lib/publish.d.ts +0 -5
- package/src/lib/subscribe.d.ts +0 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ray-js/wechat-mqtt",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2-beta-2",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@ray-js/wechat-helper": "^0.1.
|
|
29
|
-
"@ray-js/wechat-event": "^0.1.
|
|
28
|
+
"@ray-js/wechat-helper": "^0.1.2-beta-2",
|
|
29
|
+
"@ray-js/wechat-event": "^0.1.2-beta-2"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {}
|
|
32
32
|
}
|
package/src/index.d.ts
CHANGED
package/src/lib/auth.d.ts
CHANGED
package/src/lib/connect.d.ts
CHANGED
package/src/lib/constant.d.ts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 控制报文类型
|
|
3
|
-
*/
|
|
4
1
|
export declare enum PacketType {
|
|
5
2
|
Reserved = 0,
|
|
6
3
|
CONNECT = 1,
|
|
@@ -19,9 +16,6 @@ export declare enum PacketType {
|
|
|
19
16
|
DISCONNECT = 14,
|
|
20
17
|
AUTH = 15
|
|
21
18
|
}
|
|
22
|
-
/**
|
|
23
|
-
* 属性标记
|
|
24
|
-
*/
|
|
25
19
|
export declare enum PropertySign {
|
|
26
20
|
sessionExpiryInterval = 17,
|
|
27
21
|
receiveMaximum = 33,
|
package/src/lib/disconnect.d.ts
CHANGED
package/src/lib/factory.d.ts
CHANGED
|
@@ -1,17 +1,6 @@
|
|
|
1
1
|
import { Adapter, ClientConntroller, Options } from "./interface";
|
|
2
2
|
declare type Judge = () => boolean;
|
|
3
3
|
declare type Connect = (url: string, version?: number) => Promise<Adapter>;
|
|
4
|
-
/**
|
|
5
|
-
* 添加 Websocket 适配器
|
|
6
|
-
* 用于适配不同平台下 WebSocket
|
|
7
|
-
* @param judge 适配器是否生效判断
|
|
8
|
-
* @param creater 适配器生成函数
|
|
9
|
-
* @param priority 适配器是否优先,若为 true,则会优先尝试判断适配器
|
|
10
|
-
*/
|
|
11
4
|
export declare const addAdapter: (judge: Judge, creater: Connect, priority?: boolean) => void;
|
|
12
|
-
/**
|
|
13
|
-
* 创建适配器
|
|
14
|
-
* @returns
|
|
15
|
-
*/
|
|
16
5
|
export declare const createClient: (options: Options) => Promise<ClientConntroller>;
|
|
17
6
|
export {};
|
package/src/lib/interface.d.ts
CHANGED
|
@@ -1,33 +1,11 @@
|
|
|
1
1
|
export interface Adapter {
|
|
2
|
-
/**
|
|
3
|
-
* 关闭连接
|
|
4
|
-
*/
|
|
5
2
|
close: () => void;
|
|
6
|
-
/**
|
|
7
|
-
* 监听连接关闭
|
|
8
|
-
* @param cb
|
|
9
|
-
*/
|
|
10
3
|
onClose(cb: (ev: any) => void): void;
|
|
11
|
-
/**
|
|
12
|
-
* 发送消息
|
|
13
|
-
* @param data
|
|
14
|
-
*/
|
|
15
4
|
send(data: ArrayBuffer | ArrayBufferView): void;
|
|
16
|
-
/**
|
|
17
|
-
* 接收到消息监听
|
|
18
|
-
*/
|
|
19
5
|
onMessage(cb: (res: {
|
|
20
6
|
data: ArrayBuffer;
|
|
21
7
|
}) => void): void;
|
|
22
|
-
/**
|
|
23
|
-
* 网络连接成功
|
|
24
|
-
* @param cb
|
|
25
|
-
*/
|
|
26
8
|
onOpen(cb: (data: any) => void): void;
|
|
27
|
-
/**
|
|
28
|
-
* 连接出错
|
|
29
|
-
* @param cb
|
|
30
|
-
*/
|
|
31
9
|
onError(cb: (ev: any) => void): void;
|
|
32
10
|
}
|
|
33
11
|
export interface MQTTMessage {
|
|
@@ -35,151 +13,46 @@ export interface MQTTMessage {
|
|
|
35
13
|
payload: Uint8Array;
|
|
36
14
|
}
|
|
37
15
|
export interface ClientConntroller {
|
|
38
|
-
/**
|
|
39
|
-
* 配置
|
|
40
|
-
*/
|
|
41
16
|
options: Options;
|
|
42
|
-
/**
|
|
43
|
-
* 协议版本
|
|
44
|
-
*/
|
|
45
17
|
protocolVersion: number;
|
|
46
|
-
/**
|
|
47
|
-
* 服务端是否保存了会话
|
|
48
|
-
* 值为0|1
|
|
49
|
-
*/
|
|
50
18
|
sessionPresent: number;
|
|
51
19
|
connect(isReconnect?: boolean): Promise<any>;
|
|
52
20
|
isClose(): boolean;
|
|
53
|
-
/**
|
|
54
|
-
* 是否在线
|
|
55
|
-
*/
|
|
56
21
|
isOnline(): boolean;
|
|
57
|
-
/**
|
|
58
|
-
* 0 表示等待连接或连接中,1 为连接成功,2 为未连接
|
|
59
|
-
*/
|
|
60
22
|
getStatus(): 0 | 1 | 2;
|
|
61
|
-
/**
|
|
62
|
-
* 关闭连接
|
|
63
|
-
*/
|
|
64
23
|
close: () => void;
|
|
65
|
-
/**
|
|
66
|
-
* 监听连接关闭
|
|
67
|
-
* @param cb
|
|
68
|
-
*/
|
|
69
24
|
onClose(cb: (ev: any) => void): void;
|
|
70
|
-
/**
|
|
71
|
-
* 发送消息
|
|
72
|
-
* @param data
|
|
73
|
-
*/
|
|
74
25
|
send(data: ArrayBuffer | ArrayBufferView): void;
|
|
75
|
-
/**
|
|
76
|
-
* 连接出错
|
|
77
|
-
* @param cb
|
|
78
|
-
*/
|
|
79
26
|
onError(cb: (ev: any) => void): void;
|
|
80
|
-
/**
|
|
81
|
-
* 接收到消息监听
|
|
82
|
-
*/
|
|
83
27
|
onMessage(cb: (data: Uint8Array) => void): void;
|
|
84
28
|
offMessage(cb: (data: Uint8Array) => void): void;
|
|
85
29
|
offClose(cb: (ev: any) => void): void;
|
|
86
30
|
offError(cb: (ev: any) => void): void;
|
|
87
31
|
emitError(data: any): void;
|
|
88
|
-
/**
|
|
89
|
-
* mqtt 收到消息触发
|
|
90
|
-
* @param cb
|
|
91
|
-
*/
|
|
92
32
|
emitMqttMessage(data: MQTTMessage): void;
|
|
93
|
-
/**
|
|
94
|
-
* 注册 mqtt 收到消息事件
|
|
95
|
-
* @param cb
|
|
96
|
-
*/
|
|
97
33
|
onMqttMessage(cb: (data: MQTTMessage) => void): void;
|
|
98
|
-
/**
|
|
99
|
-
* 移除 mqtt 收到消息事件
|
|
100
|
-
* @param cb
|
|
101
|
-
*/
|
|
102
34
|
offMqttMessage(cb: (data: MQTTMessage) => void): void;
|
|
103
|
-
/**
|
|
104
|
-
* topic 别名处理
|
|
105
|
-
*/
|
|
106
35
|
applyTopic: (topicAlias: number, topicName: string) => void;
|
|
107
|
-
/**
|
|
108
|
-
* 通过别名获取 Topic
|
|
109
|
-
*/
|
|
110
36
|
getTopic: (topicAlias: number) => string;
|
|
111
|
-
/**
|
|
112
|
-
* 验证主题正确性
|
|
113
|
-
*/
|
|
114
37
|
checkTopic: (topicName: string) => boolean;
|
|
115
|
-
/**
|
|
116
|
-
* 加入主题
|
|
117
|
-
* @param topic
|
|
118
|
-
* @returns
|
|
119
|
-
*/
|
|
120
38
|
addTopic: (topic: string) => void;
|
|
121
|
-
/**
|
|
122
|
-
* 移除主题
|
|
123
|
-
* @param topic
|
|
124
|
-
* @returns
|
|
125
|
-
*/
|
|
126
39
|
removeTopic: (topic: string) => void;
|
|
127
|
-
/**
|
|
128
|
-
* 清除所有主题
|
|
129
|
-
* @returns
|
|
130
|
-
*/
|
|
131
40
|
clearTopic: () => void;
|
|
132
41
|
}
|
|
133
42
|
export declare type QoS = 0 | 1 | 2;
|
|
134
43
|
export declare type UserProperties = Record<string, string | string[]>;
|
|
135
44
|
export interface Options {
|
|
136
|
-
/**
|
|
137
|
-
* mqtt 连接地址
|
|
138
|
-
*/
|
|
139
45
|
url: string;
|
|
140
|
-
/**
|
|
141
|
-
* 账号
|
|
142
|
-
*/
|
|
143
46
|
username?: string;
|
|
144
|
-
/**
|
|
145
|
-
* 账号密码
|
|
146
|
-
*/
|
|
147
47
|
password?: string;
|
|
148
|
-
/**
|
|
149
|
-
* 客户端id
|
|
150
|
-
*/
|
|
151
48
|
clientId: string;
|
|
152
|
-
/**
|
|
153
|
-
* 协议版本
|
|
154
|
-
*/
|
|
155
49
|
protocolVersion?: number;
|
|
156
|
-
/**
|
|
157
|
-
* 心跳间隔时间
|
|
158
|
-
*/
|
|
159
50
|
keepalive?: number;
|
|
160
|
-
/**
|
|
161
|
-
* 是否为新会话
|
|
162
|
-
*/
|
|
163
51
|
clean?: boolean;
|
|
164
|
-
/**
|
|
165
|
-
* 遗嘱消息配置
|
|
166
|
-
*/
|
|
167
52
|
will?: {
|
|
168
|
-
/**
|
|
169
|
-
* 遗嘱主题
|
|
170
|
-
*/
|
|
171
53
|
topic: string;
|
|
172
|
-
/**
|
|
173
|
-
* 遗嘱数据
|
|
174
|
-
*/
|
|
175
54
|
payload: Uint8Array | string;
|
|
176
|
-
/**
|
|
177
|
-
* the QoS
|
|
178
|
-
*/
|
|
179
55
|
qos: QoS;
|
|
180
|
-
/**
|
|
181
|
-
* the retain flag
|
|
182
|
-
*/
|
|
183
56
|
retain: boolean;
|
|
184
57
|
properties?: {
|
|
185
58
|
willDelayInterval?: number;
|
|
@@ -191,9 +64,6 @@ export interface Options {
|
|
|
191
64
|
userProperties?: UserProperties;
|
|
192
65
|
};
|
|
193
66
|
};
|
|
194
|
-
/**
|
|
195
|
-
* 协议版本 5 properties
|
|
196
|
-
*/
|
|
197
67
|
properties?: {
|
|
198
68
|
sessionExpiryInterval?: number;
|
|
199
69
|
receiveMaximum?: number;
|
|
@@ -205,55 +75,19 @@ export interface Options {
|
|
|
205
75
|
authenticationMethod?: string;
|
|
206
76
|
authenticationData?: Uint8Array;
|
|
207
77
|
};
|
|
208
|
-
/**
|
|
209
|
-
*
|
|
210
|
-
* 连接超时时间
|
|
211
|
-
* 单位秒,默认 10 秒
|
|
212
|
-
*/
|
|
213
78
|
connectTimeout?: number;
|
|
214
|
-
/**
|
|
215
|
-
* 认证处理方法
|
|
216
|
-
* 在收到auth报文时触发
|
|
217
|
-
*/
|
|
218
79
|
onAuth?: (options: AuthOptions) => AuthOptions;
|
|
219
|
-
/**
|
|
220
|
-
* 当接收到消息且 qos 为 1 时的处理函数
|
|
221
|
-
* 如果不定义,则默认返回原因码 0
|
|
222
|
-
*/
|
|
223
80
|
onPuback?: (options: Message) => PuplishResponse;
|
|
224
|
-
/**
|
|
225
|
-
* 在收到 Pubrec 报文时用于返回 Pubrel 的处理函数,
|
|
226
|
-
* 如果不定义,则默认返回原因码 0
|
|
227
|
-
*
|
|
228
|
-
*/
|
|
229
81
|
onPubrel?: (options: PuplishResponse) => PuplishResponse;
|
|
230
|
-
/**
|
|
231
|
-
* 在收到 publish 报文时触发,用于返回 Pubrec 的处理函数
|
|
232
|
-
* 如果不定义,则默认返回原因码 0
|
|
233
|
-
*/
|
|
234
82
|
onPubrec?: (options: Message) => PuplishResponse;
|
|
235
|
-
/**
|
|
236
|
-
* 在接收到Pubrel时,用于处理 Pubcomp 返回
|
|
237
|
-
* 如果不定义,则默认返回原因码 0
|
|
238
|
-
*/
|
|
239
83
|
onPubcomp?: (options: PuplishResponse) => PuplishResponse;
|
|
240
84
|
}
|
|
241
85
|
export declare type QOS = 0 | 1 | 2;
|
|
242
86
|
export interface Message {
|
|
243
|
-
/**
|
|
244
|
-
* 消息标识
|
|
245
|
-
* qos > 0时必填
|
|
246
|
-
*/
|
|
247
87
|
id?: number;
|
|
248
88
|
dup?: boolean;
|
|
249
89
|
qos?: QOS;
|
|
250
|
-
/**
|
|
251
|
-
* 主题名
|
|
252
|
-
*/
|
|
253
90
|
topicName: string;
|
|
254
|
-
/**
|
|
255
|
-
* 协议5版本需要此值
|
|
256
|
-
*/
|
|
257
91
|
properties?: {
|
|
258
92
|
payloadFormatIndicator?: boolean;
|
|
259
93
|
messageExpiryInterval?: number;
|
|
@@ -281,13 +115,7 @@ export interface MessageOption {
|
|
|
281
115
|
};
|
|
282
116
|
}
|
|
283
117
|
export interface DisconnectOptions {
|
|
284
|
-
/**
|
|
285
|
-
* 原因码,默认为0
|
|
286
|
-
*/
|
|
287
118
|
reasonCode?: number;
|
|
288
|
-
/**
|
|
289
|
-
* 属性,协议版本5支持
|
|
290
|
-
*/
|
|
291
119
|
properties?: {
|
|
292
120
|
sessionExpiryInterval?: number;
|
|
293
121
|
reasonString?: string;
|
|
@@ -296,13 +124,7 @@ export interface DisconnectOptions {
|
|
|
296
124
|
};
|
|
297
125
|
}
|
|
298
126
|
export interface AuthOptions {
|
|
299
|
-
/**
|
|
300
|
-
* 原因码
|
|
301
|
-
*/
|
|
302
127
|
reasonCode: number;
|
|
303
|
-
/**
|
|
304
|
-
* 属性,协议版本5支持
|
|
305
|
-
*/
|
|
306
128
|
properties?: {
|
|
307
129
|
authenticationMethod: string;
|
|
308
130
|
authenticationData: string;
|
|
@@ -312,63 +134,25 @@ export interface AuthOptions {
|
|
|
312
134
|
}
|
|
313
135
|
export interface PuplishResponse {
|
|
314
136
|
id: number;
|
|
315
|
-
/**
|
|
316
|
-
* 原因码
|
|
317
|
-
*/
|
|
318
137
|
reasonCode?: number;
|
|
319
|
-
/**
|
|
320
|
-
* 属性,协议版本5支持
|
|
321
|
-
*/
|
|
322
138
|
properties?: {
|
|
323
139
|
reasonString?: string;
|
|
324
140
|
userProperties?: UserProperties;
|
|
325
141
|
};
|
|
326
142
|
}
|
|
327
143
|
export interface Client {
|
|
328
|
-
/**
|
|
329
|
-
* 0 表示等待连接或连接中,1 为连接成功,2 为未连接
|
|
330
|
-
*/
|
|
331
144
|
getStatus(): 0 | 1 | 2;
|
|
332
|
-
/**
|
|
333
|
-
* 接收消息监听
|
|
334
|
-
*/
|
|
335
145
|
onMessage(cb: (data: MQTTMessage) => void): void;
|
|
336
|
-
/**
|
|
337
|
-
* 取消接收消息监听
|
|
338
|
-
*/
|
|
339
146
|
offMessage(cb: (data: MQTTMessage) => void): void;
|
|
340
|
-
/**
|
|
341
|
-
* 发送消息
|
|
342
|
-
*/
|
|
343
147
|
publish(topic: string, message: string | Uint8Array, option?: MessageOption): void;
|
|
344
|
-
/**
|
|
345
|
-
* 重新认证
|
|
346
|
-
*/
|
|
347
148
|
reAuth(option: AuthOptions): void;
|
|
348
|
-
/**
|
|
349
|
-
* 断开连接
|
|
350
|
-
*/
|
|
351
149
|
disconnect(option?: DisconnectOptions): void;
|
|
352
|
-
/**
|
|
353
|
-
* 关闭事件
|
|
354
|
-
* @param cb
|
|
355
|
-
*/
|
|
356
150
|
onClose(cb: () => void): void;
|
|
357
|
-
/**
|
|
358
|
-
* 错误监听
|
|
359
|
-
* @param cb
|
|
360
|
-
*/
|
|
361
151
|
onError(cb: (e: any) => void): void;
|
|
362
|
-
/**
|
|
363
|
-
* 订阅
|
|
364
|
-
*/
|
|
365
152
|
subscribe: (topics: Topic[], options?: SubscribeOption) => Promise<{
|
|
366
153
|
err?: Record<string, number>;
|
|
367
154
|
properties?: any;
|
|
368
155
|
}>;
|
|
369
|
-
/**
|
|
370
|
-
* 取消订阅
|
|
371
|
-
*/
|
|
372
156
|
unsubscribe: (topic: string[], options?: UnsubscribeOption) => Promise<{
|
|
373
157
|
err?: Record<string, number>;
|
|
374
158
|
properties?: any;
|
package/src/lib/packet.d.ts
CHANGED
|
@@ -1,34 +1,17 @@
|
|
|
1
1
|
import { PropertySign } from "./constant";
|
|
2
2
|
declare type WriteData = (data: string | number | number[] | Uint8Array) => void;
|
|
3
|
-
/**
|
|
4
|
-
* 创建数据包
|
|
5
|
-
* @param cmd 控制报文
|
|
6
|
-
* @param fixHeader 固定报文中,4个低字节位数值
|
|
7
|
-
* @returns
|
|
8
|
-
*/
|
|
9
3
|
export declare const createPacket: (cmd: number, fixHeader?: number) => {
|
|
10
4
|
header: (data: number | number[] | Uint8Array, needLen?: boolean, isVariable?: boolean) => void;
|
|
11
5
|
payload: (data: string | number | number[] | Uint8Array, needLen?: boolean, isVariable?: boolean) => void;
|
|
12
6
|
cleanCache(): void;
|
|
13
|
-
/**
|
|
14
|
-
*
|
|
15
|
-
* @param data
|
|
16
|
-
*/
|
|
17
7
|
cache: (data: string | number | number[] | Uint8Array, needLen?: boolean, isVariable?: boolean) => void;
|
|
18
8
|
putHeader(): void;
|
|
19
9
|
putPayload(): void;
|
|
20
10
|
getCache(): Uint8Array;
|
|
21
|
-
/**
|
|
22
|
-
* 获取 packet 数据
|
|
23
|
-
* @returns
|
|
24
|
-
*/
|
|
25
11
|
getPacket: () => Uint8Array;
|
|
26
12
|
};
|
|
27
13
|
export declare const writeString: (sign: PropertySign) => (v: string, write: WriteData) => void;
|
|
28
14
|
export declare const writePair: (sign: PropertySign) => (properies: Record<string, string | string[]>, write: WriteData) => void;
|
|
29
|
-
/**
|
|
30
|
-
* 属性值类型
|
|
31
|
-
*/
|
|
32
15
|
export declare const writeProperty: {
|
|
33
16
|
sessionExpiryInterval: (value: number, write: WriteData) => void;
|
|
34
17
|
receiveMaximum: (value: number, write: WriteData) => void;
|
|
@@ -48,10 +31,5 @@ export declare const writeProperty: {
|
|
|
48
31
|
correlationData: (value: Uint8Array, write: WriteData) => void;
|
|
49
32
|
subscriptionIdentifier: (value: number, write: WriteData) => void;
|
|
50
33
|
};
|
|
51
|
-
/**
|
|
52
|
-
* 转化 properties 的数据
|
|
53
|
-
* @param properies
|
|
54
|
-
* @param write
|
|
55
|
-
*/
|
|
56
34
|
export declare const packetProperties: (properies: any, write: WriteData) => void;
|
|
57
35
|
export {};
|
package/src/lib/parse.d.ts
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import { AuthOptions, ClientConntroller, Message, PuplishResponse } from "./interface";
|
|
2
|
-
/**
|
|
3
|
-
* 属性值类型
|
|
4
|
-
*/
|
|
5
2
|
export declare const parseProperty: {
|
|
6
3
|
sessionExpiryInterval: (data: Uint8Array, offset: number) => number[];
|
|
7
4
|
receiveMaximum: (data: Uint8Array, offset: number) => number[];
|
|
@@ -21,21 +18,7 @@ export declare const parseProperty: {
|
|
|
21
18
|
correlationData: (data: Uint8Array, offset: number) => [Uint8Array, number];
|
|
22
19
|
subscriptionIdentifier: (data: Uint8Array, offset: number) => number[];
|
|
23
20
|
};
|
|
24
|
-
/**
|
|
25
|
-
* 解析 properties
|
|
26
|
-
* @param data
|
|
27
|
-
* @returns
|
|
28
|
-
*/
|
|
29
21
|
export declare const parseProperties: (data: Uint8Array) => Record<string, any>;
|
|
30
|
-
/**
|
|
31
|
-
* 解析认证授权数据
|
|
32
|
-
* @param data
|
|
33
|
-
* @returns
|
|
34
|
-
*/
|
|
35
22
|
export declare const parseAuth: (data: Uint8Array) => AuthOptions;
|
|
36
|
-
/**
|
|
37
|
-
* 解析消息数据
|
|
38
|
-
* @param data
|
|
39
|
-
*/
|
|
40
23
|
export declare const parsePublish: (data: Uint8Array, client: ClientConntroller) => Message;
|
|
41
24
|
export declare const parsePublishResponse: (data: Uint8Array, client: ClientConntroller) => PuplishResponse;
|
package/src/lib/ping.d.ts
CHANGED
package/src/lib/publish.d.ts
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
import { ClientConntroller, Message, PuplishResponse } from "./interface";
|
|
2
|
-
/**
|
|
3
|
-
* 发布消息
|
|
4
|
-
* @param client
|
|
5
|
-
* @param data
|
|
6
|
-
*/
|
|
7
2
|
export declare const publish: (client: ClientConntroller, message: Message) => Promise<void>;
|
|
8
3
|
export declare const puback: (client: ClientConntroller, message: PuplishResponse) => Promise<void>;
|
|
9
4
|
export declare const pubrel: (client: ClientConntroller, message: PuplishResponse) => Promise<void>;
|
package/src/lib/subscribe.d.ts
CHANGED
|
@@ -20,18 +20,10 @@ interface UnSubscribeOptions {
|
|
|
20
20
|
};
|
|
21
21
|
topics: string[];
|
|
22
22
|
}
|
|
23
|
-
/**
|
|
24
|
-
* 订阅消息
|
|
25
|
-
* @param client
|
|
26
|
-
* @param options
|
|
27
|
-
*/
|
|
28
23
|
export declare const subscribe: (client: ClientConntroller, options: SubscribeOptions) => Promise<{
|
|
29
24
|
reasonCode: Uint8Array;
|
|
30
25
|
properties?: any;
|
|
31
26
|
}>;
|
|
32
|
-
/**
|
|
33
|
-
* 取消订阅
|
|
34
|
-
*/
|
|
35
27
|
export declare const unsubscribe: (client: ClientConntroller, subscribe: UnSubscribeOptions) => Promise<{
|
|
36
28
|
reasonCode: Uint8Array;
|
|
37
29
|
properties?: any;
|