Skip to main content
Http2Stream.setTimeout - node__http2.d.ts - Node documentation
method Http2Stream.setTimeout

Usage in Deno

```typescript import { type Http2Stream } from "node:node__http2.d.ts"; ```
Http2Stream.setTimeout(
msecs: number,
callback?: () => void,
): void
```js import http2 from 'node:http2'; const client = http2.connect('http://example.org:8000'); const { NGHTTP2_CANCEL } = http2.constants; const req = client.request({ ':path': '/' }); // Cancel the stream if there's no activity after 5 seconds req.setTimeout(5000, () => req.close(NGHTTP2_CANCEL)); ```

Parameters

msecs: number
optional
callback: () => void

Return Type

void