diff --git a/lib/HueBridge.js b/lib/HueBridge.js index df76891..a051764 100644 --- a/lib/HueBridge.js +++ b/lib/HueBridge.js @@ -996,8 +996,8 @@ HueBridge.prototype.listen = function () { } HueBridge.prototype.listen2 = async function () { - const eventStream = new EventStreamClient(this.hueClient, { retryTime: 15 }) - eventStream + this.eventStream = new EventStreamClient(this.hueClient, { retryTime: 15 }) + this.eventStream .on('error', (error) => { if (error.request == null) { this.log.warn('%s: event stream error: %s', this.name, formatError(error)) @@ -1064,8 +1064,8 @@ HueBridge.prototype.listen2 = async function () { this.log.warn('%s: event stream error: %s', this.name, formatError(error)) } }) - await eventStream.init() - eventStream.listen() + await this.eventStream.init() + this.eventStream.listen() } // ===== Heartbeat =============================================================