To reuse connections when making http.requests I'd like to use the ForeverAgent without having to use the whole request module.
I'm using node v0.8.15
Is that possible? Can someone tell me how?
With the layout/structure of the current version of Mikeal's request module, you should be able to do something like the following:
var ForeverAgent = require('request/forever');
var myAgent = new ForeverAgent();
var myRequest = http.request({/* … */, agent:myAgent});
/* … */
See the node.js http documentation for a bit more details on the agent option although it is sparse; I don't see any documentation whatsoever (beyond the source code) for this module's "forever" agent itself.
ForeverAgent has recently been split into its own module, so you should just use that.