Skip to content

Commit 50f9202

Browse files
committed
Increase max listeners on stream to 1000
1 parent 9eda185 commit 50f9202

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/client.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,9 @@ MqttClient.prototype._setupStream = function () {
245245
// Echo connection errors
246246
parser.on('error', this.emit.bind(this, 'error'));
247247

248+
// many drain listeners are needed for qos 1 callbacks if the connection is intermittent
249+
this.stream.setMaxListeners(1000);
250+
248251
clearTimeout(this.connackTimer);
249252
this.connackTimer = setTimeout(function () {
250253
that._cleanUp(true);

0 commit comments

Comments
 (0)