Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

46 lines (34 sloc) 1.424 kb

whooohoo jackpot

build status

Jackpot is a fault tolerant connection pool for Node.js, it automatically cleans up after it self and detects broken connections. It does not need to be released, as it will allocate connections based on their readyState / write abilities.


var ConnectionPool = require('jackpot');

// first argument: size of the connection pool
// second argument: optional connection factory
var pool = new ConnectionPool(100);

// every connection pool requires a factory which is used to generate / setup
// the initial net.Connection
// it should return a new net.Connection instance..
pool.factory(function () {
  return net.connect(port, host)

// now that the pool is setup we can allocate a connection, the allocate
// requires a callback as it can be async..
pool.allocte(function (err, connection) {
  // error: when we failed to get a connection
  // connection: the allocated net.connection if there isn't an error

// call if you want to free connections from the pool, the arugment
// you supply is the amount of connections you want to keep; // keep only 10 healthy connections kill the rest.

// kill the whole connection pool:

For more API information, fork this repo and add more.. or look at the test file.


Jump to Line
Something went wrong with that request. Please try again.