messenger-pool

0.0.6 • Public • Published

Messenger-pool - Fast Node.js json over tcp connection pool

Installation

npm install messenger-pool

Build Status npm dependencies

this package is based on Messenger.js the syntax is the same, only this repo supports both a single connection, and a connection pool

this packege uses node-pool to do the connection pooling

Example:

var messenger = require('messenger-pool');
var poolOptions = {
    max : 10,
    min : 2,
    idleTimeoutMillis : 30000
};
 
var client = messenger.createSpeakerPool(8000, poolOptions);
var server = messenger.createListener(8000);
 
server.on('give it to me', function(message, data){
  message.reply({'you':'got it'});
});
 
setInterval(function(){
  client.request('give it to me', {hello:'world'}, function(data){
    console.log(data);
  });
}, 1000);

Output:

> {'you':'got it'}
> {'you':'got it'}
> ...etc...

more examples, and syntax for single connection without pooling could be found in Messenger.js docs

all optional and default values for poolOptions could be found in node-pool docs

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.6
    4
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.0.6
    4
  • 0.0.5
    2
  • 0.0.2
    2
  • 0.0.1
    2

Package Sidebar

Install

npm i messenger-pool

Weekly Downloads

4

Version

0.0.6

License

none

Last publish

Collaborators

  • molow