Sudhanshu Garg
Sudhanshu Garg

Reputation: 105

Change socketio config dynamically

I am using ngx-socket-io for realtime notifications in angular app

My current requirement is to enable notifications or socketio requests to server only if enabled in settings DB

I was thinking to make this change by changing the socketio module config during runtime, i.e. when I get the settings from API call.

My current code in app.module:

if(environment.angularEnv == "local") {
  config = { url: 'http://localhost:8001', options: {} };
} else {
  config = { url: location.origin, options: {} };
}
imports: [
    BrowserModule,
    SocketIoModule.forRoot(config),

Upvotes: 0

Views: 388

Answers (0)

Related Questions