本文整理汇总了TypeScript中http.Server.setTimeout方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Server.setTimeout方法的具体用法?TypeScript Server.setTimeout怎么用?TypeScript Server.setTimeout使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类http.Server
的用法示例。
在下文中一共展示了Server.setTimeout方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
import * as http from 'http';
import * as url from 'url';
import * as net from 'net';
// http Server
{
const server: http.Server = new http.Server();
// test public props
const maxHeadersCount: number = server.maxHeadersCount;
const timeout: number = server.timeout;
const listening: boolean = server.listening;
const keepAliveTimeout: number = server.keepAliveTimeout;
server.setTimeout().setTimeout(1000).setTimeout(() => {}).setTimeout(100, () => {});
}
// http IncomingMessage
// http ServerResponse
{
// incoming
const incoming: http.IncomingMessage = new http.IncomingMessage(new net.Socket());
incoming.setEncoding('utf8');
// stream
incoming.pause();
incoming.resume();
// response
const res: http.ServerResponse = new http.ServerResponse(incoming);