Multiple request pools with node.js request module

I'm using the node.js request module to fetch the contents of URLs. it works great, and I can even pass in maxSockets: XXX to have it do more in parallel.

However, I have a few places in my code where I need to do different requests to different places. I'd like to be able to create two separate pools of 25 requests at a time, etc. However, the request module doesn't seem set up to have a constructor to create different pools.

Suggestions for the how I might go about this?

I'd ideally like something along the following lines:

var r1 = new request({ maxSockets: 25 });
var r2 = new request({ maxSockets: 25 });

and then just start using them both for fetching stuff …

Any suggestions how to go about this?

I'm not sure if I get your question right - maybe because I've never used the request module.

But, by reading the module README, I think you could, in some file of your project, export a function which defaults some options for you.
Somewhat like this:

function createRequest( url, callback ) {
  return request({
    pool: { maxSockets: 25 },
    // Maybe more things here
    url: url
  }, callback );
}

Hope it helps you