Odonno / ngrx-signalr-core

A library to handle realtime SignalR (.NET Core) events using @angular, rxjs and the @ngrx library
https://www.npmjs.com/package/ngrx-signalr-core
MIT License
28 stars 13 forks source link

fix error and double disconnected actions on stopSignalRHub action #99

Closed vulzee closed 1 year ago

vulzee commented 1 year ago

Fixes issue #26

I propose changing this._errorSubject.next(error); to if (error) { this._errorSubject.next(error); } due to fact this._connection.onclose emits undefined in case of gracefully stopped connection and instance of Error while the error occurred. This eliminates throw of @ngrx/signalr/stopHub action on stopSignalRHub(hub).

To fix double @ngrx/signalr/disconnected I propose removing this._stateSubject.next(disconnected); because the this._stateSubject.next would be called in this._connection.onclose after the connection stops.

Odonno commented 1 year ago

Looks good to me.