# coroutines

Jordi Saumell

11/29/2019, 8:30 AM
Hello! I have a question about channels/flow: I’d like to emit events and be able to cancel subscription and later have another instance subscribe to the same channel (with the events accumulated when there is no subscriber). My understanding is that this can be achieved with a Channel with unlimited capacity, but the problem I face is that when the subscriber’s scope is cancelled the channel is closed. If I use GlobalScope it does not occur, but then it is my understanding that it is not unsubscribing. So, how can I have a channel that does not get closed when I unsubscribe?


11/29/2019, 8:32 AM
it sounds like you do not want to actually close the channel, but use something like
which has a separate subscription lifecycle

Jordi Saumell

12/02/2019, 3:54 PM
Sorry, I couldn’t try it until now. The problem I face with a Broadcast channel is that it does not accumulate events. So, if there is no subscriber the event is lost (I use consumeEach at the receiver and BroadcastChannel<T>(100) with send at the emitter