I have an RxJs question that might be good for helping others (and myself) understand RxJS Observables and timing.
Lets say I have a service that looks like so: getData(something){ // ...code return IntervalObservable.create(1000) .flatMap(() => { return this.http.get(url).map(res => //do something with res ); }); }
This is getting called in a component like so: this.data$ = this.MyService.getData(this.something)
A) How would I fire this request to get the response back right away (instead of waiting 1 second) and then wait another 5 seconds to resend the request? B) Let say I want to add other observables to this, and have them all call the service and get data back at the same time. How would I do that? I read some place about hot and cold observables and .share(), but I don't know if that is relevant.
My use case is an app that will allow you to add multiple devices to listen to a server and sync data, but they all need to sync at the same time. I am not sure this is even the best way to do it, but it works so far for one item. Thanks for the guidance!