It looks like you're new here. If you want to get involved, click one of these buttons!
  ngOnInit() {
    this.socketService.observe('ticks').subscribe(console.log);
    this.socketService.request('holdings').subscribe((holdings: Holding[]) => {
      this.holdings = holdings;
    });
  }
Angular Service:
  request(type: string, data: any = {}) {
    const observer = Observable.create((ob: Observer<any>) => {
      // logged in user token, not access_token from zerodha
      this.socket.on(`${type}-${this.user.token}-success`, (data: any) => ob.next(data));
    }).pipe(take(1));
    this.socket.emit(type, {...data, token: this.user.token});
    return observer;
  }
  observe(type: string) {
    return Observable.create((ob: Observer<any>) => {
      this.socket.on(`${type}-${this.user.token}`, (data: any) => ob.next(data));
    });
  }
NodeJs Server:
  const listenWithZerodha = (eventName, process) => {
    client.on(eventName, async (signal) => {
      // ensure user is logged in and create app object
      process(email, app, signal).then(
        data => client.emit(`${eventName}-${signal.token}-success`, data),
        err => client.emit(`${eventName}-${signal.token}-failure`, err));
    });
  };
  listenWithZerodha('holdings', (email, app, {token}) => app.holdings().then((arr) => {
    // not zerodha, but my app around zerodha
    app.subscribe(arr.map((a) => a.instrument_token), (ticks) => {
      console.log(ticks);
      client.emit(`ticks-${token}`, ticks);
    });
    return arr;
  }));
App implementation:
  async holdings() {
    return this.connect.getHoldings();
  }
  subscribe(stocks, listener) {
    this.ticker.connect();
    this.ticker.subscribe(stocks);
    this.ticker.setMode(this.ticker.modeFull, stocks);
    this.ticker.on('ticks', (...params) => {
      console.log(params);
      listener(...params);
    });
  }
Please let me know if there is a issue in the above implementation.
Feel free to close this thread.