Demo: timeout
We can use timeout operator to throw an error in case no new item arrives for the specified period of time.
timeout(timeoutInMiliseconds)
//Delay the output of a number N by N seconds
let input = of(0, 2, 1,5,3, 4)
.pipe(concatMap(v => of(v).pipe(delay(v*1000))));
//throw error in case there is no new item for 3 sec
let process1 = timeout(3000);
//catch any error and convert to the given observable
let process2 = catchError(err => of('e'));
let output = input.pipe(process1 , process2)
.subscribe(v => console.log(v))