pool

0.4.1 • Public • Published

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');
    });        
  });

Readme

Keywords

none

Package Sidebar

Install

npm i pool

Weekly Downloads

271

Version

0.4.1

License

none

Last publish

Collaborators

  • mikeal