# timeout

#### signature: `timeout(due: number, scheduler: Scheduler): Observable`

## 지정된 기간 전에 값이 방출되지 않는 경우, 에러를 발생

### 예시

**예시 1: 2.5초 뒤에 Timeout**

( [StackBlitz](https://stackblitz.com/edit/typescript-eegqyz?file=index.ts\&devtoolsheight=100) | [jsBin](http://jsbin.com/gonakiniho/edit?js,console) | [jsFiddle](https://jsfiddle.net/btroncone/nr4e1ofy/1/) )

```javascript
// RxJS v6+
import { of } from 'rxjs';
import { concatMap, timeout, catchError, delay } from 'rxjs/operators';

// 요청을 수행하는 함수
function makeRequest(timeToDelay) {
  return of('Request Complete!').pipe(delay(timeToDelay));
}

of(4000, 3000, 2000)
  .pipe(
    concatMap(duration =>
      makeRequest(duration).pipe(
        timeout(2500),
        catchError(error => of(`Request timed out after: ${duration}`))
      )
    )
  )
  /*
   *  "Request timed out after: 4000"
   *  "Request timed out after: 3000"
   *  "Request Complete!"
   */
  .subscribe(val => console.log(val));
```

### 추가 자료

* [timeout](https://rxjs.dev/api/operators/timeout):newspaper: - 공식 문서

> :open\_file\_folder: Source Code: <https://github.com/ReactiveX/rxjs/blob/master/src/internal/operators/timeout.ts>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://junwoo45.gitbook.io/learn-rxjs-korean/learn-rxjs/recipes-1/utility/timeout.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
