File tree Expand file tree Collapse file tree 1 file changed +3
-9
lines changed Expand file tree Collapse file tree 1 file changed +3
-9
lines changed Original file line number Diff line number Diff line change @@ -65,14 +65,6 @@ const defaultConnectOptions = {
65
65
writeCache : true ,
66
66
}
67
67
68
- const socketErrors = [
69
- 'ECONNREFUSED' ,
70
- 'EADDRINUSE' ,
71
- 'ECONNRESET' ,
72
- 'ENOTFOUND' ,
73
- 'ETIMEDOUT' ,
74
- ]
75
-
76
68
export type MqttProtocol =
77
69
| 'wss'
78
70
| 'ws'
@@ -765,7 +757,9 @@ export default class MqttClient extends TypedEventEmitter<MqttClientEventCallbac
765
757
766
758
const streamErrorHandler = ( error ) => {
767
759
this . log ( 'streamErrorHandler :: error' , error . message )
768
- if ( socketErrors . includes ( error . code ) ) {
760
+ // error.code will only be set on NodeJS env, browser don't allow to detect errors on sockets
761
+ // also emitting errors on browsers seems to create issues
762
+ if ( error . code ) {
769
763
// handle error
770
764
this . log ( 'streamErrorHandler :: emitting error' )
771
765
this . emit ( 'error' , error )
You can’t perform that action at this time.
0 commit comments