multiple subscriptions using web sockets in angular

Viewed 68

I'm experienced in angular but new to web sockets. I have to create a dashboard of different trading stocks and their prices using web sockets.

I can send the stock ID to like

const SERVER_URL = webSocket('ws://159.89.15.214:8080/');

and

this.myWebSocket.next({
    subscribe: 'the stockID here'
});

and I get the response like

this.myWebSocket.asObservable().pipe(distinctUntilChanged(), debounceTime(100))
    .subscribe(
        (dataFromServer) = > {
            return dataFromServer;
        },

But I have to do it dynamically for multiple stocks using an input field to send the stockID and show it.

I'm totally clueless. Any help would be appreciated.

0 Answers
Related