server.keepAliveTimeout
- 类型:<number> 超时(毫秒)。默认值:
5000(5 秒)。
服务器在完成最后一次响应的写入后,需要等待额外传入数据的空闲毫秒数,然后套接字将被销毁。
【The number of milliseconds of inactivity a server needs to wait for additional incoming data, after it has finished writing the last response, before a socket will be destroyed.】
此超时值与server.keepAliveTimeoutBuffer选项结合使用以确定实际的套接字超时,计算公式为:
socketTimeout = keepAliveTimeout + keepAliveTimeoutBuffer
如果服务器在保持活动超时触发之前接收到新数据,它将重置常规的不活动超时,即server.timeout。
【This timeout value is combined with the
server.keepAliveTimeoutBuffer option to determine the actual socket
timeout, calculated as:
socketTimeout = keepAliveTimeout + keepAliveTimeoutBuffer
If the server receives new data before the keep-alive timeout has fired, it
will reset the regular inactivity timeout, i.e., server.timeout.】
将值设置为 0 会禁用对传入连接的 keep-alive 超时行为。
将值设置为 0 会使 HTTP 服务器的行为类似于 8.0.0 之前的 Node.js 版本,这些版本没有 keep-alive 超时。
【A value of 0 will disable the keep-alive timeout behavior on incoming
connections.
A value of 0 makes the HTTP server behave similarly to Node.js versions prior
to 8.0.0, which did not have a keep-alive timeout.】
套接字超时逻辑是在连接时设置的,因此更改此值只会影响与服务器的新连接,而不会影响任何现有连接。
【The socket timeout logic is set up on connection, so changing this value only affects new connections to the server, not any existing connections.】