use()
respond()
check()
wait()
join()
reject()
next()
timeout()
timeout()
operatorWill track each incoming packet. If not responded to in given timeframe (in milliseconds),
will respond to it with a timeout signal (408
):
1import { timeout } from 'rxxpress';
2
3router.get('/')
4.pipe(
5 timeout(200), // --> respond with a timeout if requests are not responded to after 200 milliseconds
6 ...
7)
8.subscribe();
By default, timeout()
operates in safe mode, i.e. it will not throw an error
in case of a timeout. You can disable that behavior by providing a second argument
to it:
1router.get('/')
2.pipe(
3 timeout(200, false), // --> not in safe mode, will throw an error in case of timeout
4 ...
5)
6.subscribe(
7 undefined,
8 err => { // --> catch the error as well
9 ... // --> catch the error as well
10 } // --> catch the error as well
11)