Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unable to change the url. #120

Open
nickraphael opened this issue May 29, 2018 · 1 comment
Open

unable to change the url. #120

nickraphael opened this issue May 29, 2018 · 1 comment

Comments

@nickraphael
Copy link

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?

@matthew-valenti
Copy link

matthew-valenti commented Jun 1, 2018

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);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants