diff --git a/package-lock.json b/package-lock.json index 2c118eb..bd4a3fd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "ngx-mqtt", - "version": "6.1.0", + "version": "6.1.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 0d76540..2264009 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ngx-mqtt", - "version": "6.1.0", + "version": "6.1.1", "description": "ngx mqtt client library", "main": "bundles/ngx-mqtt.min.js", "module": "./src/index.js", diff --git a/src/mqtt.service.ts b/src/mqtt.service.ts index b096946..c841d53 100644 --- a/src/mqtt.service.ts +++ b/src/mqtt.service.ts @@ -144,15 +144,15 @@ export class MqttService { () => { const subscription: Subscription = new Subscription(); this.client.subscribe(filterString, (err, granted: ISubscriptionGrant[]) => { - if(granted) { // granted can be undefined when an error occurs when the client is disconnecting - granted.forEach((granted_: ISubscriptionGrant) => { - if (granted_.qos === 128) { - delete this.observables[granted_.topic]; - this.client.unsubscribe(granted_.topic); - rejected.error(`subscription for '${granted_.topic}' rejected!`); - } - this._onSuback.emit({filter: filterString, granted: granted_.qos !== 128}); - }); + if (granted) { // granted can be undefined when an error occurs when the client is disconnecting + granted.forEach((granted_: ISubscriptionGrant) => { + if (granted_.qos === 128) { + delete this.observables[granted_.topic]; + this.client.unsubscribe(granted_.topic); + rejected.error(`subscription for '${granted_.topic}' rejected!`); + } + this._onSuback.emit({filter: filterString, granted: granted_.qos !== 128}); + }); } }); subscription.add(() => {