Jp Valery on Unsplash

Better HTTP Polling with RxJS 5

Hugo Di Francesco

--

Here is the implementation for a function that takes a Promise-based fetch function and a function that decides if a response has been successful (from a polling perspective) and polls the fetch function until the isSuccess function returns true:

import { Observable, from, interval } from 'rxjs';
import { switchMap, takeWhile } from 'rxjs/operators';
const POLLING_INTERVAL = 600; //…

--

--