Publishers and subscribers with backpressure #470
Unanswered
falcowinkler
asked this question in
Q&A
Replies: 1 comment
-
I ended up leaving the "Effect" architecture as it is, and just handling the buffering in the view store, if it's helpful for anyone. I don't think it's very elegant, but it works nicely. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm having a great time with composable architecture but ran into a situation i find hard to implement with Effects
Basically want to achieve the following
Content
for my app.I started to read into how this would be achievable in pure Combine. There i would create my custom
Publisher
andSubscriber
instances and handle backpressure withinrequest(_ demand: Subscribers.Demand)
etc.What i don't understand is this: After i managed to code up a Subscriber, i have a
Subscription
instance that i hold internally, on which i can.request(Demand)
more data. But how do i wire this up with the view store exactly? On the view store i need to return an effect that just produces a single value, that is just displayed when it arrives.I thought about storing the subscription somewhere, and returning the custom
Publisher
asEffect
when the view initializes. Then i could just request more data on the subscription, and wait for the event to come in?If you know of any example of something similar, that would also greatly help. I didn't find anything in the case studies.
Right now, i simply wrote a function that returns an Effect, which produces a single
Content
value. The problem with that, is that i can not buffer the values, i always have to request a new one after the user action happened. Perhaps i can hack around that with keeping a buffer in my Reducer state, but that seems like a hack to me and i'm interested in the best practice solution.Beta Was this translation helpful? Give feedback.
All reactions