I have a stream that calls a service that returns a stream that needs the info of the original stream for the request.
this.messages$ = this.selectedChat$
.switchMap(chat => this.chatService.subscribeMessages(chat.room))
.map(messages) =>
messages.map((message: any) => {
//Here need add information of the chat object
return message;
})
);
All operators that I see that can merge the streams and separate them later (like combineLatest) receive parameters, therefore, I can´t use the original stream info to call the service that generates the other stream, and I would not like to use subscribe on the original stream and return a new stream inside the subscribe because it's a little messy code.
Any advice?