Closed lucyluu22 closed 1 year ago
The keepaliveAgent
is only created once and then re-used for all messages.
Ah, you mean when you (as and end-user of my module) create multiple connections to the server... I get it. I'll look into it when I find the time.
Added the option in version 1.8.9
Eg
var httpntlm = require('httpntlm');
var http = require('http');
var myKeepaliveAgent = new http.Agent({keepAlive: true});
httpntlm.get({
url: "http://localhost:3000",
username: 'm$',
password: 'stinks',
workstation: 'choose.something',
domain: 'somedomain',
agent: myKeepaliveAgent
}, function (err, res){
if(err) return console.log(err);
console.log(res.headers);
console.log(res.body);
});
Correct me if I'm wrong, but wouldn't re-using a http agent instead of creating a new one every request mean you'd only need to do do the handshake once on the same server (since the connection would be persisted)?
May also help issue #5