Skip to content

add emitters for "error" and "offline"#11

Open
wolfgangcolsman wants to merge 1 commit intomicroclimates:masterfrom
wolfgangcolsman:patch-1
Open

add emitters for "error" and "offline"#11
wolfgangcolsman wants to merge 1 commit intomicroclimates:masterfrom
wolfgangcolsman:patch-1

Conversation

@wolfgangcolsman
Copy link

Registering a listener on "error" allows addressing the following issue with onStatsInterval when the interval is triggered while end() is processing. If the "error" event is not handled, the process with exit.

...\node_modules\mqtt\lib\client.js:370
this.emit('error', new Error('client disconnecting'))
^
Error: client disconnecting
at MqttClient._checkDisconnecting (...\node_modules\mqtt\lib\client.js:370:26)
at MqttClient.publish (...\node_modules\mqtt\lib\client.js:408:12)
at module.exports.proto.onStatsInterval (...\node_modules\homie-device\lib\homieDevice.js:205:16)
at module.exports.proto.onConnect (...\node_modules\homie-device\lib\homieDevice.js:182:5)
at MqttClient. (...\node_modules\homie-device\lib\homieDevice.js:112:7)
at MqttClient.emit (events.js:201:15)
at MqttClient._handleConnack (...\node_modules\mqtt\lib\client.js:918:10)
at MqttClient._handlePacket (...\node_modules\mqtt\lib\client.js:350:12)
at work (...\node_modules\mqtt\lib\client.js:292:12)
at Writable.writable._write (...\node_modules\mqtt\lib\client.js:302:5)
at doWrite (...\node_modules\readable-stream\lib_stream_writable.js:428:64)
at writeOrBuffer (...\node_modules\readable-stream\lib_stream_writable.js:417:5)
at Writable.write (...\node_modules\readable-stream\lib_stream_writable.js:334:11)
at Socket.ondata (_stream_readable.js:696:22)
at Socket.emit (events.js:196:13)
at addChunk (_stream_readable.js:290:12)
at readableAddChunk (_stream_readable.js:271:11)
at Socket.Readable.push (_stream_readable.js:226:10)
at TCP.onStreamRead (internal/stream_base_commons.js:166:17)

Registering a listener on "error" allows addressing the following issue with onStatsInterval when the interval is triggered while end() is processing. If the "error" event is not handled, the process with exit.

...\node_modules\mqtt\lib\client.js:370
      this.emit('error', new Error('client disconnecting'))
                         ^
Error: client disconnecting
    at MqttClient._checkDisconnecting (...\node_modules\mqtt\lib\client.js:370:26)
    at MqttClient.publish (...\node_modules\mqtt\lib\client.js:408:12)
    at module.exports.proto.onStatsInterval (...\node_modules\homie-device\lib\homieDevice.js:205:16)
    at module.exports.proto.onConnect (...\node_modules\homie-device\lib\homieDevice.js:182:5)
    at MqttClient.<anonymous> (...\node_modules\homie-device\lib\homieDevice.js:112:7)
    at MqttClient.emit (events.js:201:15)
    at MqttClient._handleConnack (...\node_modules\mqtt\lib\client.js:918:10)
    at MqttClient._handlePacket (...\node_modules\mqtt\lib\client.js:350:12)
    at work (...\node_modules\mqtt\lib\client.js:292:12)
    at Writable.writable._write (...\node_modules\mqtt\lib\client.js:302:5)
    at doWrite (...\node_modules\readable-stream\lib\_stream_writable.js:428:64)
    at writeOrBuffer (...\node_modules\readable-stream\lib\_stream_writable.js:417:5)
    at Writable.write (...\node_modules\readable-stream\lib\_stream_writable.js:334:11)
    at Socket.ondata (_stream_readable.js:696:22)
    at Socket.emit (events.js:196:13)
    at addChunk (_stream_readable.js:290:12)
    at readableAddChunk (_stream_readable.js:271:11)
    at Socket.Readable.push (_stream_readable.js:226:10)
    at TCP.onStreamRead (internal/stream_base_commons.js:166:17)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant