我想将http.Agent配置为在5秒后断开连接,但从未发生过。
服务器配置为在20秒后断开连接(对于此测试)
连接在20秒后断开(服务器代替客户端断开连接)
var http = require('http');
var myAgent = new http.Agent({keepAlive:true, keepAliveMsecs:5000});
var client = http.get({host:'localhost', agent:myAgent}, function(incMsg){
incMsg.on('data',
Clients that use persistent connections SHOULD limit the number of simultaneous
connections that they maintain to a given server. A single-user client SHOULD
NOT maintain more than 2 connections with any server or proxy.
[..]
我对“应该”这个词特别不确定.这有什么意义?为什么?
我知道HTTP持久化连接,也称为HTTP,是使用相同的TCP连接发送和接收多个HTTP请求