http2stream.setTimeout(msecs, callback)
历史
版本 | 变化 |
---|---|
v18.0.0 | 将无效回调传递给 |
v8.4.0 | 添加于:v8.4.0 |
参数
msecs
<number>callback
<Function>
const http2 = require('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));
相关用法
- Node.js Http2Stream.sendTrailers(headers)用法及代码示例
- Node.js Http2Stream close用法及代码示例
- Node.js Http2Stream Headers用法及代码示例
- Node.js Http2Stream Response用法及代码示例
- Node.js Http2Stream用法及代码示例
- Node.js Http2Stream Timeout用法及代码示例
- Node.js Http2ServerResponse.finished用法及代码示例
- Node.js Http2Session stream用法及代码示例
- Node.js Http2ServerResponse.getHeaderNames()用法及代码示例
- Node.js Http2Session.ping([payload, ]callback)用法及代码示例
- Node.js Http2ServerResponse.statusMessage用法及代码示例
- Node.js Http2ServerResponse.writableEnded用法及代码示例
- Node.js Http2Session timeout用法及代码示例
- Node.js Http2ServerRequest.stream用法及代码示例
- Node.js Http2ServerResponse.setHeader()用法及代码示例
- Node.js Http2ServerRequest.method用法及代码示例
- Node.js Http2ServerResponse.getHeader()用法及代码示例
- Node.js Http2ServerResponse.addTrailers()用法及代码示例
- Node.js Http2ServerRequest.url用法及代码示例
- Node.js Http2ServerResponse.setTimeout()用法及代码示例
- Node.js Http2ServerRequest.complete用法及代码示例
- Node.js Http2ServerResponse.stream用法及代码示例
- Node.js Http2ServerRequest.destroy()用法及代码示例
- Node.js Http2ServerResponse.removeHeader()用法及代码示例
- Node.js Http2ServerResponse.hasHeader()用法及代码示例
注:本文由纯净天空筛选整理自nodejs.org大神的英文原创作品 Http2Stream.setTimeout(msecs, callback)。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。