mirror of
https://github.com/http-party/node-http-proxy.git
synced 2025-12-08 20:59:18 +00:00
Pool -- Simple HTTP client pooling
Install
npm install pool
Super simple to use
Pool has two core usage scenarios: creating a pool and creating a set of pools. Creating a pool is easy:
var pool = require('pool'),
sys = require('sys'),
local = pool.createPool('80', 'localhost');
client = local.request('GET', '/', function (request) {
// You can work with the request here just as you would as if it
// was returned from http.createClient
request.on('end', function () {
sys.puts('Request ended');
});
});
Creating a set of pools can be accomplished using a PoolManager:
var pool = require('pool'),
manager = pool.createPoolManager(),
local = manager.getPool('80', 'localhost');
client = local.request('GET', '/', function (request) {
// You can work with the request here just as you would as if it
// was returned from http.createClient
request.on('end', function () {
sys.puts('Request ended');
});
});