loopback-sdk-builder icon indicating copy to clipboard operation
loopback-sdk-builder copied to clipboard

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

Open imike57 opened this issue 6 years ago • 0 comments

What type of issue are you creating?

  • [ ] Bug
  • [ ] Enhancement
  • [x] Question

What version of this module are you using?

  • [x] 2.0.10 (Stable)
  • [ ] 2.1.0-rc.n (2.1 Release Candidate n)
  • [ ] Other

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

imike57 avatar Oct 08 '18 16:10 imike57