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

设置 socket 的超时时间。 如果发生超时,则触发服务器对象的 'timeout' 事件,并传入 socket 作为参数。

默认情况下,服务器的超时时间是 2 分钟,且超时后的 socket 会被自动销毁。 如果为服务器的 '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.