I'm working with the latest Angular and Typescript and RxJS 5.
Angular has currently made RxJS a necessity. I've used C# primarily for over 10 years and I'm very much used to Linq/Lambdas/fluent syntax which I assume formed the basis of Reactive.
I would like to make an Http get call with an increasing timeout value on retry, but I'm having a problem seeing how to do that and still keeping everything in the pipeline (not using external state).
I get that I can do this, but it will just retry using the same timeout value.
myHttpObservable.timeout(1000).retry(2);
The documentation for RxJS has been poor in many places and asking about it on here only got my question deleted out of existence, which is sad...so I was forced to look through the source.
Is there a way to retry with an increasing timeout duration each time in a way that keeps state in the pipeline? Also, I want an innitial timeout on the first attempt.
I've tried things similar to this at first, but realized the confusing retryWhen operator is not really intended for what I want:
myHttpObservable.timeout(1000).retryWhen((theSubject: Observable<Error>) => {
return aNewMyObservableCreatedinHere.timeout(2000);
});
I know I could accomplish this using external state, but I'm basically looking for an elegant solution that, I think, is what they are kind of driving for with the reactive style of programming.