-
Notifications
You must be signed in to change notification settings - Fork 1.9k
ArrayBroadcastChannel that delivers new subscribers a value #1761
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I think your use case could be solved with Flow if it had an operator like RxJava's |
We currently receive the I guess I would want to understand why |
android/architecture-components-samples#63 Both behaviors have their place. Event streams such as click events should probably be stateless without a replay. State streams like a view state should probably be stateful with a replay. |
@RBusarow good points. I guess our setup is more of a unique case that I would love to reduce the number of event streams. I would need to set up some more tests to confirm but our main concern for our logging portion is that we do not want to drop any data due to the number of events being sent to each channel (aka backpressure). This is why we are using the I was looking into the |
Here is a design for |
Closing this issue as superseded by the design of shared flows in #2034. |
In our current codebase, we are using
ArrayBroadcastChannel
s to perform detailed logging. This works great since it does not conflate anything, which is what we need for our logs to be complete.Our problem is that we want to use the same BroadcastChannels to update our UI. If the UI subscriber is created after the
BroadcastChannel
is first initialized, the UI will never show values unless another broadcast would take place. This is where theConflatedBroadcastChannel
s would solve our UI problem when it delivers new subscribers with the latest (or even last) value.Currently, I do not see any possible path forward except having duplicate BroadcastChannels (one being an
ArrayBroadcastChannel
for logging, and one beingConflatedBroadcastChannel
for the UI). I was considering extending one of those classes our creating my own class to handle this situation but it seems this would be a difficult path forward with classes that I would need being marked private.Please let me know if anyone has found a solution to a similar situation. Maybe I am missing something and this can easily be accomplished. Thanks in advance for reading this!
The text was updated successfully, but these errors were encountered: