I’ll create an observable (through a variety of means) and return it to interested parties, but when they’re done listening, I’d like to tear down the observable so it doesn’t continue consuming resources. Another way to think of it as creating topics in a pub sub system. When no one is subscribed to a topic any more, you don’t want to hold the topic and its filtering around anymore.
I’ll create an observable (through a variety of means) and return it to interested
Share
Rx already has an operator to suit your needs – well two actually –
Publish&RefCount.Here’s how to use them:
Simple.