server.setTimeout([msecs][, callback])


设置套接字的超时值,并在服务器对象上触发 'timeout' 事件,如果发生超时,则将套接字作为参数传入。

如果 Server 对象上有 'timeout' 事件监听器,则将使用超时套接字作为参数调用它。

但是,如果将回调分配给服务器的 'timeout' 事件,则必须显式处理超时。

Sets the timeout value for sockets, and emits a 'timeout' event on the Server object, passing the socket as an argument, if a timeout occurs.

If there is a 'timeout' event listener on the Server object, then it will be called with the timed-out socket as an argument.

By default, the Server's timeout value is 2 minutes, and sockets are destroyed automatically if they time out. However, if a callback is assigned to the Server's 'timeout' event, timeouts must be handled explicitly.

To change the default timeout use the --http-server-default-timeout flag.