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/lib/client.js CHANGED
@@ -32,14 +32,6 @@ const defaultConnectOptions = {
32
32
  resubscribe: true
33
33
  }
34
34
 
35
- const socketErrors = [
36
- 'ECONNREFUSED',
37
- 'EADDRINUSE',
38
- 'ECONNRESET',
39
- 'ENOTFOUND'
40
- ]
41
-
42
- // Other Socket Errors: EADDRINUSE, ECONNRESET, ENOTFOUND.
43
35
 
44
36
  const errors = {
45
37
  0: '',
@@ -454,7 +446,9 @@ MqttClient.prototype._setupStream = function () {
454
446
 
455
447
  function streamErrorHandler (error) {
456
448
  debug('streamErrorHandler :: error', error.message)
457
- if (socketErrors.includes(error.code)) {
449
+ // error.code will only be set on NodeJS env, browse don't allow to detect erros on sockets
450
+ // also emitting errors on browser seems to create issues
451
+ if (error.code) {
458
452
  // handle error
459
453
  debug('streamErrorHandler :: emitting error')
460
454
  that.emit('error', error)
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": "4.3.7",
4
+ "version": "4.3.8",
5
5
  "contributors": [
6
6
  "Adam Rudd <adamvrr@gmail.com>",
7
7
  "Matteo Collina <matteo.collina@gmail.com> (https://github.com/mcollina)",