ng2-signalr icon indicating copy to clipboard operation
ng2-signalr copied to clipboard

unable to change the url.

Open nickraphael opened this issue 6 years ago • 1 comments

Currently it seems that the url has to be provided via the config when forRoot is called in the module...

imports: [ SignalRModule.forRoot(createConfig) ]

I don't know the url at this point - it's is loaded at runtime from a json file. Is there a way to set the url at runtime?

nickraphael avatar May 29 '18 01:05 nickraphael

These are simplified code fragments based on what we're doing which is similar.

// Minimal config in app.module.ts
export function createConfig(): SignalRConfiguration {
    const config = new SignalRConfiguration();
    config.logging = false;
    return config;
}

// Set connection options dynamically anywhere in your code.
let options: IConnectionOptions = { hubName, url };

// Create connection anywhere in your code.
this.connection = this.signalR.createConnection(this.options);

matthew-valenti avatar Jun 01 '18 16:06 matthew-valenti