FooEvents. I want to continuely call/update
ListFoosuntil a user selects one. Then I want to make repeated calls to
FooEventswith an (offset,maxEvents) creating a new stream of events`
Another quick question -- if I have a subject (a state subject, for example) should I be completing and/or unsubscribing from it directly when I want to destroy it? Or is unsubbing all subscribers sufficient?
Unsubscribe and complete have different effects. Compete would terminate all other subscribers too, but if your subscribers have inner streams (like inside a switchMap), those might keep going for a bit longer.
There is also a third option to use
takeUntil to unsubscribe.
No need to do both. Either complete it to let it shut down gracefully or unsubscribe to put an instant stop to the stream. (It wont terminate anything, but operators will no longer call their followup, ignoring a few exceptions like
finalize). (Doing both wont harm but it's not needed either.)
source1.pipe(publish(src1 => source2.pipe(publish(src2 => concat( merge( src1, src2.pipe( takeUntil(src1Completed), toArray(), mergeAll() )), src2) ))))