ng2-signalr
ng2-signalr copied to clipboard
unable to change the url.
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?
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);