-
-
Notifications
You must be signed in to change notification settings - Fork 28
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
Concatenation of EventStreams #1
Comments
In the absence of built-in observable completion feature you could simulate it in a rather ugly way. You could write custom logic using an Implementing a completion feature, while not a priority for now, is not out of the question. What are the real life use cases for concatenation? |
Let's say I have a server-client scenario. In my client I have an eventstream coming in from a remote API. The events are mapped into a state which renders the ui. Furthermore I have some initialization logic in my app, which are also modeled as Events: val apiEvents: EventStream[ApiEvent] = ???
val localEvents: EventStream[ApiEvent] = EventStream.fromSeq(...) Then I would like to combine these such that the Another use case I had are observables derived from futures. So a future can be converted into an observable emitting only a single value eventually. Then I wanted to combine these while keeping the order. |
So... do you want Or does Re: Creating observables from futures and flattening of observables of futures – that will be the next thing I implement in Airstream, regardless of completion / concat concepts. |
Here, I was thinking that
Nice! |
Ok so it sounds like you want it to behave more or less like rxjs concat, which starts the next stream if and when the previous one completes. Another way to possibly accomplish that is the I'm not sure what do the streams / events actually represent in your case, but I'm hoping the integration with futures that I mentioned will solve that issue. |
Indeed, that could work in this case. I will try it out and let you know. Thank you! |
Though, from reading the code, I got the impression that |
You're correct that it works like For anyone else having similar problems with lacking operators, keep in mind that Airstream is very forgiving of impurity – all our stuff is shared execution, that is, the stream will run exactly once regardless of how many subscribers it has (as long as it's at least one). So it's relatively easy to create custom operators that keep internal state. |
Thanks for the detailed response! I think I can work with a sentinel value for now. It should even be possible to make this generic enough to be reusable for my project :) |
Can we concatenate multiple
EventStreams
?The use case is that I have two streams that should emit elements after each other:
In the readme, I saw that there is no concept of closing Observables. So, I was wondering whether this is possible?
The text was updated successfully, but these errors were encountered: