spierce7
02/05/2019, 7:21 PMBehaviorSubject
with a BroadcastChannel
? ConflatedBroadcastChannel
allows for the loss of events after subscription, while BehaviorSubject
guarantees all events to be delivered.
I've tried swapping to an ArrayBroadcastChannel
to help ensure all events are delivered, but I have no way to ensure that the current value is delivered to a new subscriber upon a new subscription being opened. Any suggestions?julioyg
02/05/2019, 9:15 PMConflatedBroadcastChannel
or so the doc says, BheaviourSubject
only delivers the last value, the rest of them get lostspierce7
02/05/2019, 11:14 PMbehaviorSubject.onNext(1)
behaviorSubject.onNext(2)
behaviorSubject.onNext(3)
behaviorSubject.onNext(4)
I'm guaranteed to receive all 4 events to all subscribers.
If I call
conflatedBroadcastChannel.send(1)
conflatedBroadcastChannel.send(2)
conflatedBroadcastChannel.send(3)
conflatedBroadcastChannel.send(4)
I'm only guaranteed to receive the 4th event on my subscribers. It's very likely that with the above code, I'll actually only receive the 1st and 4th event, and the 2nd and 3rd event will be lost. In fact, that's what I'm seeing consistently in my code running only on my Android main thread.