mqtt 5.9.0 → 5.9.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/BufferedDuplex.js +3 -1
- package/build/lib/BufferedDuplex.js.map +1 -1
- package/build/lib/client.d.ts +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 +3 -4
- 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 +10 -7
- package/dist/mqtt.min.js +5 -5
- package/package.json +1 -1
- package/src/lib/BufferedDuplex.ts +3 -1
- package/src/lib/client.ts +4 -1
- package/src/lib/connect/ws.ts +3 -1
- package/src/lib/handlers/ack.ts +9 -5
package/package.json
CHANGED
package/src/lib/client.ts
CHANGED
|
@@ -385,7 +385,10 @@ export type OnMessageCallback = (
|
|
|
385
385
|
export type OnPacketCallback = (packet: Packet) => void
|
|
386
386
|
export type OnCloseCallback = () => void
|
|
387
387
|
export type OnErrorCallback = (error: Error | ErrorWithReasonCode) => void
|
|
388
|
-
export type PacketCallback = (
|
|
388
|
+
export type PacketCallback = (
|
|
389
|
+
error?: Error | ErrorWithReasonCode,
|
|
390
|
+
packet?: Packet,
|
|
391
|
+
) => any
|
|
389
392
|
export type CloseCallback = (error?: Error) => void
|
|
390
393
|
|
|
391
394
|
export interface MqttClientEventCallbacks {
|
package/src/lib/connect/ws.ts
CHANGED
|
@@ -260,7 +260,9 @@ const browserStreamBuilder: StreamBuilder = (client, opts) => {
|
|
|
260
260
|
let { data } = event
|
|
261
261
|
if (data instanceof ArrayBuffer) data = Buffer.from(data)
|
|
262
262
|
else data = Buffer.from(data as string, 'utf8')
|
|
263
|
-
proxy.
|
|
263
|
+
if (proxy && !proxy.destroyed) {
|
|
264
|
+
proxy.push(data)
|
|
265
|
+
}
|
|
264
266
|
}
|
|
265
267
|
|
|
266
268
|
function socketWriteBrowser(
|
package/src/lib/handlers/ack.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Other Socket Errors: EADDRINUSE, ECONNRESET, ENOTFOUND, ETIMEDOUT.
|
|
2
2
|
|
|
3
|
-
import { PacketHandler } from '../shared'
|
|
3
|
+
import { PacketHandler, ErrorWithReasonCode } from '../shared'
|
|
4
4
|
|
|
5
5
|
export const ReasonCodes = {
|
|
6
6
|
0: '',
|
|
@@ -82,8 +82,10 @@ const handleAck: PacketHandler = (client, packet) => {
|
|
|
82
82
|
const pubackRC = packet.reasonCode
|
|
83
83
|
// Callback - we're done
|
|
84
84
|
if (pubackRC && pubackRC > 0 && pubackRC !== 16) {
|
|
85
|
-
err = new
|
|
86
|
-
|
|
85
|
+
err = new ErrorWithReasonCode(
|
|
86
|
+
`Publish error: ${ReasonCodes[pubackRC]}`,
|
|
87
|
+
pubackRC,
|
|
88
|
+
)
|
|
87
89
|
client['_removeOutgoingAndStoreMessage'](messageId, () => {
|
|
88
90
|
cb(err, packet)
|
|
89
91
|
})
|
|
@@ -102,8 +104,10 @@ const handleAck: PacketHandler = (client, packet) => {
|
|
|
102
104
|
const pubrecRC = packet.reasonCode
|
|
103
105
|
|
|
104
106
|
if (pubrecRC && pubrecRC > 0 && pubrecRC !== 16) {
|
|
105
|
-
err = new
|
|
106
|
-
|
|
107
|
+
err = new ErrorWithReasonCode(
|
|
108
|
+
`Publish error: ${ReasonCodes[pubrecRC]}`,
|
|
109
|
+
pubrecRC,
|
|
110
|
+
)
|
|
107
111
|
client['_removeOutgoingAndStoreMessage'](messageId, () => {
|
|
108
112
|
cb(err, packet)
|
|
109
113
|
})
|