New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

zmq-pool

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zmq-pool

Build a connection pool on top of ZMQ

  • 0.1.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

ZMQ Pool JS

js-semistandard-style Dependency Status devDependency Status

Warning - work in progress, the API may drastically change in the upcoming weeks

Establish a pool of ZMQ connections.

Example

var zmq = require('zmq');
var ZmqPool = require('zmq-pool');
var uri = 'tcp://127.0.0.1:12345';

var socket = zmq.socket('rep');
socket.bind(uri, function (err) {
  if (err) throw err;

  console.log('Server bound to ' + uri);

  socket.on('message', function (data) {
    var send = data.toString().toLowerCase();
    console.log('[SERVER] Received:', data.toString());
    socket.send(send);
  });
});

var pool = new ZmqPool({monitor: true});
var count = 0;

for (var i = 0; i < 10; i++) {
  (function () {
    var j = i;
    var connection = pool.borrow(uri, {pattern: 'req'});
    connection.connect(function (err) {
      if (err) throw err;
      connection.send('IM SENDING MSG NUM ' + j + ' AND MY ID IS ' + connection.id);
      connection.on('message', function (response) {
        console.log('[CLIENT] Received:', response.toString());
        connection.done();
        if (++count >= 10) {
          console.log('Closing...');
          pool.killAll();
          socket.close();
        }
      });
    });
  })();
}

Keywords

FAQs

Package last updated on 18 Dec 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc