mqtt 4.3.6 → 4.3.8
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/dist/mqtt.js +15 -10
- package/dist/mqtt.min.js +1 -1
- package/lib/client.js +15 -10
- package/package.json +1 -1
package/dist/mqtt.js
CHANGED
|
@@ -34,14 +34,6 @@ const defaultConnectOptions = {
|
|
|
34
34
|
resubscribe: true
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
const socketErrors = [
|
|
38
|
-
'ECONNREFUSED',
|
|
39
|
-
'EADDRINUSE',
|
|
40
|
-
'ECONNRESET',
|
|
41
|
-
'ENOTFOUND'
|
|
42
|
-
]
|
|
43
|
-
|
|
44
|
-
// Other Socket Errors: EADDRINUSE, ECONNRESET, ENOTFOUND.
|
|
45
37
|
|
|
46
38
|
const errors = {
|
|
47
39
|
0: '',
|
|
@@ -456,7 +448,9 @@ MqttClient.prototype._setupStream = function () {
|
|
|
456
448
|
|
|
457
449
|
function streamErrorHandler (error) {
|
|
458
450
|
debug('streamErrorHandler :: error', error.message)
|
|
459
|
-
|
|
451
|
+
// error.code will only be set on NodeJS env, browse don't allow to detect erros on sockets
|
|
452
|
+
// also emitting errors on browser seems to create issues
|
|
453
|
+
if (error.code) {
|
|
460
454
|
// handle error
|
|
461
455
|
debug('streamErrorHandler :: emitting error')
|
|
462
456
|
that.emit('error', error)
|
|
@@ -1585,7 +1579,18 @@ MqttClient.prototype._handleAck = function (packet) {
|
|
|
1585
1579
|
const that = this
|
|
1586
1580
|
let err
|
|
1587
1581
|
|
|
1588
|
-
|
|
1582
|
+
// Checking `!cb` happens to work, but it's not technically "correct".
|
|
1583
|
+
//
|
|
1584
|
+
// Why? This code assumes that "no callback" is the same as that "we're not
|
|
1585
|
+
// waiting for responses" (puback, pubrec, pubcomp, suback, or unsuback).
|
|
1586
|
+
//
|
|
1587
|
+
// It would be better to check `if (!this.outgoing[messageId])` here, but
|
|
1588
|
+
// there's no reason to change it and risk (another) regression.
|
|
1589
|
+
//
|
|
1590
|
+
// The only reason this code works is becaues code in MqttClient.publish,
|
|
1591
|
+
// MqttClinet.subscribe, and MqttClient.unsubscribe ensures that we will
|
|
1592
|
+
// have a callback even if the user doesn't pass one in.)
|
|
1593
|
+
if (!cb) {
|
|
1589
1594
|
debug('_handleAck :: Server sent an ack in error. Ignoring.')
|
|
1590
1595
|
// Server sent an ack in error, ignore it.
|
|
1591
1596
|
return
|