mean-expert-official / loopback-sdk-builder

Tool for auto-generating Software Development Kits (SDKs) for LoopBack
Other
399 stars 177 forks source link

IO Service - What is ME:RT:1://event ? #626

Open imike57 opened 5 years ago

imike57 commented 5 years ago

What type of issue are you creating?

What version of this module are you using?

Write other if any:

Please add a description for your issue:

Hi,

I try to use Realtime interface which use IO Service... in which we have 2 functions

  emit(event: string, data: any): void {
    this.socket.emit('ME:RT:1://event', {
        event : event,
        data  : data
    });
  }

  on(event: string): Observable<any> {
    if (this.observables[event]) { return this.observables[event]; }
    let subject: Subject<any> = new Subject<any>();
    this.socket.on(event, (res: any) => subject.next(res));
    this.observables[event] = subject.asObservable();
    return this.observables[event];
  }

for "on", ok . I can got emit from the server, but to emit to the server it's not working like IO Socket usually work this.socket.emit('event', 'data')... If I change this function to

  emit(event: string, data: any): void {
    this.socket.emit(event, data);
  }

it will work again... But each time I will regenerate the SDK, it will be back.. I would like understand this function. Why it not work like usually emit ? What is "'ME:RT:1://event'," ?

Thank's

Mike