How can I subscribe to an observable stream and combine values, even if they don't both emit?
Is there a specific RxJs operator that can help achieve this?
// function in a service
getContent(): {
return CombineLatest({
list: of([ {...} ]) // always want this to be emitted
ignore: of( null ), // subscribe but don't care if it's emitted or not.
}).pipe(
map(({ list }) => list // always return the list response
)
}
In my case, I need to stream content from the store and also listen for web socket updates simultaneously within one subscription.
Please note that the ignore stream responds via a tap outside of this example (listening to webSockets for updates), while the list is a stream of content from ngRx store.