diff --git a/projects/ngx-mqtt/src/lib/mqtt.service.ts b/projects/ngx-mqtt/src/lib/mqtt.service.ts index a82d794..131f7b6 100644 --- a/projects/ngx-mqtt/src/lib/mqtt.service.ts +++ b/projects/ngx-mqtt/src/lib/mqtt.service.ts @@ -102,10 +102,16 @@ export class MqttService { public get onSuback(): EventEmitter { return this._onSuback; } + + /** An actual connection state **/ + public get connectionState(): MqttConnectionState { + return this.state.value; + } + /** a map of all mqtt observables by filter */ public observables: { [filterString: string]: Observable } = {}; /** the connection state */ - public state: Subject = new BehaviorSubject(MqttConnectionState.CLOSED); + public state: BehaviorSubject = new BehaviorSubject(MqttConnectionState.CLOSED); /** an observable of the last mqtt message */ public messages: Subject = new Subject();