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
27 stars 13 forks source link

Defer ofHub Execution #23

Open mccow002 opened 3 years ago

mccow002 commented 3 years ago

We are using APP_INITIALIZER to load in our config settings. This means that we will not know the base url of our hub until APP_INITIALIZER completes. However, ofHub gets evaluated immediately, causing the following error: ReferenceError: Attempting to access configuration before it is set.

If the signature of ofHub was changed or overloaded to allow something like this:

ofHub(() => { hubName: 'myHub', url: `${this.configService.baseUrl}/hub` })

I think this would solve any issues caused by having to wait on the APP_INITIALIZER