request.setTimeout(msecs, callback)


Http2Stream 的超时值设置为 msecs。如果提供了回调函数,则会将其作为监听器添加到响应对象的 'timeout' 事件上。

🌐 Sets the Http2Stream's timeout value to msecs. If a callback is provided, then it is added as a listener on the 'timeout' event on the response object.

如果没有在请求、响应或服务器上添加 'timeout' 监听器,则在超时时,Http2Streams 会被销毁。如果为请求、响应或服务器的 'timeout' 事件分配了处理程序,则必须显式处理超时的套接字。

🌐 If no 'timeout' listener is added to the request, the response, or the server, then Http2Streams are destroyed when they time out. If a handler is assigned to the request, the response, or the server's 'timeout' events, timed out sockets must be handled explicitly.