mqtt 5.9.1 → 5.10.1
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/build/lib/client.d.ts +8 -5
- package/build/lib/client.js +1 -1
- package/build/lib/client.js.map +1 -1
- package/build/lib/connect/ws.js +3 -1
- package/build/lib/connect/ws.js.map +1 -1
- package/build/lib/handlers/ack.js +1 -1
- package/build/lib/handlers/ack.js.map +1 -1
- package/build/tsconfig.build.tsbuildinfo +1 -1
- package/dist/mqtt.esm.js +5 -5
- package/dist/mqtt.js +6 -4
- package/dist/mqtt.min.js +5 -5
- package/package.json +1 -2
- package/src/lib/client.ts +15 -7
- package/src/lib/connect/ws.ts +3 -1
- package/src/lib/handlers/ack.ts +1 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mqtt",
|
|
3
3
|
"description": "A library for the MQTT protocol",
|
|
4
|
-
"version": "5.
|
|
4
|
+
"version": "5.10.1",
|
|
5
5
|
"contributors": [
|
|
6
6
|
"Adam Rudd <adamvrr@gmail.com>",
|
|
7
7
|
"Matteo Collina <matteo.collina@gmail.com> (https://github.com/mcollina)",
|
|
@@ -116,7 +116,6 @@
|
|
|
116
116
|
"help-me": "^5.0.0",
|
|
117
117
|
"lru-cache": "^10.0.1",
|
|
118
118
|
"minimist": "^1.2.8",
|
|
119
|
-
"mqtt": "^5.2.0",
|
|
120
119
|
"mqtt-packet": "^9.0.0",
|
|
121
120
|
"number-allocator": "^1.0.14",
|
|
122
121
|
"readable-stream": "^4.4.2",
|
package/src/lib/client.ts
CHANGED
|
@@ -323,7 +323,7 @@ export interface IClientReconnectOptions {
|
|
|
323
323
|
}
|
|
324
324
|
export interface IClientSubscribeProperties {
|
|
325
325
|
/*
|
|
326
|
-
* MQTT 5.0
|
|
326
|
+
* MQTT 5.0 properties object of subscribe
|
|
327
327
|
* */
|
|
328
328
|
properties?: ISubscribePacket['properties']
|
|
329
329
|
}
|
|
@@ -370,12 +370,20 @@ export type ISubscriptionMap = {
|
|
|
370
370
|
resubscribe?: boolean
|
|
371
371
|
}
|
|
372
372
|
|
|
373
|
+
export interface IClientUnsubscribeProperties {
|
|
374
|
+
/*
|
|
375
|
+
* MQTT 5.0 properties object for unsubscribe
|
|
376
|
+
* */
|
|
377
|
+
properties?: IUnsubscribePacket['properties']
|
|
378
|
+
}
|
|
379
|
+
|
|
373
380
|
export { IConnackPacket, IDisconnectPacket, IPublishPacket, Packet }
|
|
374
381
|
export type OnConnectCallback = (packet: IConnackPacket) => void
|
|
375
382
|
export type OnDisconnectCallback = (packet: IDisconnectPacket) => void
|
|
376
383
|
export type ClientSubscribeCallback = (
|
|
377
384
|
err: Error | null,
|
|
378
385
|
granted?: ISubscriptionGrant[],
|
|
386
|
+
packet?: ISubackPacket,
|
|
379
387
|
) => void
|
|
380
388
|
export type OnMessageCallback = (
|
|
381
389
|
topic: string,
|
|
@@ -1241,7 +1249,7 @@ export default class MqttClient extends TypedEventEmitter<MqttClientEventCallbac
|
|
|
1241
1249
|
}
|
|
1242
1250
|
}
|
|
1243
1251
|
|
|
1244
|
-
callback(err, subs)
|
|
1252
|
+
callback(err, subs, packet2)
|
|
1245
1253
|
},
|
|
1246
1254
|
}
|
|
1247
1255
|
this.log('subscribe :: call _sendPacket')
|
|
@@ -1300,7 +1308,7 @@ export default class MqttClient extends TypedEventEmitter<MqttClientEventCallbac
|
|
|
1300
1308
|
public unsubscribe(topic: string | string[]): MqttClient
|
|
1301
1309
|
public unsubscribe(
|
|
1302
1310
|
topic: string | string[],
|
|
1303
|
-
opts?:
|
|
1311
|
+
opts?: IClientUnsubscribeProperties,
|
|
1304
1312
|
): MqttClient
|
|
1305
1313
|
public unsubscribe(
|
|
1306
1314
|
topic: string | string[],
|
|
@@ -1308,12 +1316,12 @@ export default class MqttClient extends TypedEventEmitter<MqttClientEventCallbac
|
|
|
1308
1316
|
): MqttClient
|
|
1309
1317
|
public unsubscribe(
|
|
1310
1318
|
topic: string | string[],
|
|
1311
|
-
opts?:
|
|
1319
|
+
opts?: IClientUnsubscribeProperties,
|
|
1312
1320
|
callback?: PacketCallback,
|
|
1313
1321
|
): MqttClient
|
|
1314
1322
|
public unsubscribe(
|
|
1315
1323
|
topic: string | string[],
|
|
1316
|
-
opts?:
|
|
1324
|
+
opts?: IClientUnsubscribeProperties | PacketCallback,
|
|
1317
1325
|
callback?: PacketCallback,
|
|
1318
1326
|
): MqttClient {
|
|
1319
1327
|
if (typeof topic === 'string') {
|
|
@@ -1395,11 +1403,11 @@ export default class MqttClient extends TypedEventEmitter<MqttClientEventCallbac
|
|
|
1395
1403
|
): Promise<Packet | undefined>
|
|
1396
1404
|
public unsubscribeAsync(
|
|
1397
1405
|
topic: string | string[],
|
|
1398
|
-
opts?:
|
|
1406
|
+
opts?: IClientUnsubscribeProperties,
|
|
1399
1407
|
): Promise<Packet | undefined>
|
|
1400
1408
|
public unsubscribeAsync(
|
|
1401
1409
|
topic: string | string[],
|
|
1402
|
-
opts?:
|
|
1410
|
+
opts?: IClientUnsubscribeProperties,
|
|
1403
1411
|
): Promise<Packet | undefined> {
|
|
1404
1412
|
return new Promise((resolve, reject) => {
|
|
1405
1413
|
this.unsubscribe(topic, opts, (err, packet) => {
|
package/src/lib/connect/ws.ts
CHANGED
|
@@ -256,9 +256,11 @@ const browserStreamBuilder: StreamBuilder = (client, opts) => {
|
|
|
256
256
|
/**
|
|
257
257
|
* https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/message_event
|
|
258
258
|
*/
|
|
259
|
-
function onMessage(event: MessageEvent) {
|
|
259
|
+
async function onMessage(event: MessageEvent) {
|
|
260
260
|
let { data } = event
|
|
261
261
|
if (data instanceof ArrayBuffer) data = Buffer.from(data)
|
|
262
|
+
else if (data instanceof Blob)
|
|
263
|
+
data = Buffer.from(await new Response(data).arrayBuffer())
|
|
262
264
|
else data = Buffer.from(data as string, 'utf8')
|
|
263
265
|
if (proxy && !proxy.destroyed) {
|
|
264
266
|
proxy.push(data)
|
package/src/lib/handlers/ack.ts
CHANGED