loopback-component-realtime icon indicating copy to clipboard operation
loopback-component-realtime copied to clipboard

Socket.IO url not updated using config update

Open appunnicer13 opened this issue 7 years ago • 1 comments

export class AppComponent {
  title = 'Note App';

  private note : Note = new Note();
  private reference : FireLoopRef<Note>;


  constructor(private realTime: RealTime) {
    LoopBackConfig.setBaseURL(BASE_URL);
    LoopBackConfig.setApiVersion(API_VERSION);
    this.realTime
      .onReady()
      .subscribe(() =>
        this.reference = this.realTime.FireLoop.ref<Note>(Note)
      );
  }
}

This is not working for Socket URL , socket is still using ws://0.0.0.0:3000 by default. Please update on this soon.

using "@mean-expert/loopback-component-realtime": "^1.0.0-rc.9.4",

export const BASE_URL = '//localhost:3000'; export const API_VERSION = 'api';

appunnicer13 avatar Jul 21 '17 06:07 appunnicer13

@appunnicer13 thanks for reaching out, for web socket configuration it is better to set the baseUrl within the main.ts file,

Try moving the configs to your main.ts file instead,

something like

import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { enableProdMode } from '@angular/core';
import { environment } from './environments/environment';
import { AppModule } from './app/app.module';
import {LoopBackConfig} from './app/shared/sdk';

LoopBackConfig.setBaseURL(BASE_URL);
LoopBackConfig.setApiVersion(API_VERSION);

if (environment.production) {
  enableProdMode();
}

platformBrowserDynamic().bootstrapModule(AppModule);

jonathan-casarrubias avatar Jul 21 '17 16:07 jonathan-casarrubias