mqtt 4.3.7 → 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 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
- if (socketErrors.includes(error.code)) {
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)