npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@aminya/zeromq

v5.2.16

Published

ZeroMQ for node.js

Downloads

95

Readme

zeromq.js

codecov Greenkeeper badge Build Status Build status Build Status Build status

Users | From Source | Contributors and Development | Maintainers

zeromq: Your ready to use, prebuilt ØMQ bindings for Node.js.

ØMQ provides handy functionality when working with sockets. Yet, installing dependencies on your operating system or building ØMQ from source can lead to developer frustration.

zeromq simplifies creating communications for a Node.js application by providing well-tested, ready to use ØMQ bindings. zeromq supports all major operating systems, including:

  • OS X/Darwin (x64)
  • Linux (x64, ARMv7 and ARMv8)
  • Windows (x64 and x86)

Use zeromq and take advantage of the elegant simplicity of binaries.

Installation - Users

We rely on prebuild.

Install zeromq with the following:

npm install zeromq@5

windows users: do not forget to set msvs_version according to your visual studio version 2013,2015,2017 npm config set msvs_version 2015 Now, prepare to be amazed by the wonders of binaries.

To use your system's libzmq (if it has been installed and development headers are available):

npm install zeromq@5 --zmq-external

Rebuilding for Electron

If you want to use zeromq inside your Electron application it needs to be rebuild against Electron headers. We ship prebuilt binaries for Electron so you won't need to build zeromq from source.

You can rebuild zeromq manually by running:

npm rebuild zeromq --runtime=electron --target=1.4.5

Where target is your desired Electron version. This will download the correct binary for usage in Electron.

For packaging your Electron application we recommend using electron-builder which handles rebuilding automatically. Enable the npmSkipBuildFromSource option to make use of the prebuilt binaries. For a real world example take a look at nteract.

Installation - From Source

If you are working on a Linux 32-bit system or want to install a development version, you have to build zeromq from source.

Prerequisites

Linux

  • python (v2.7 recommended, v3.x.x is not supported)
  • make
  • A proper C/C++ compiler toolchain, like GCC

Use your distribution's package manager to install.

macOS

  • python (v2.7 recommended, v3.x.x is not supported): already installed on Mac OS X
  • Xcode Command Line Tools: Can be installed with xcode-select --install

Windows

  • Option 1: Install all the required tools and configurations using Microsoft's windows-build-tools by running npm install -g windows-build-tools from an elevated PowerShell (run as Administrator).

  • Option 2: Install dependencies and configuration manually

    1. Visual C++ Build Environment:
    • Option 1: Install Visual C++ Build Tools using the Default Install option.
    • Option 2: Install Visual Studio 2015 (or modify an existing installation) and select Common Tools for Visual C++ during setup.

    :bulb: [Windows Vista / 7 only] requires .NET Framework 4.5.1

    1. Install Python 2.7 or Miniconda 2.7 (v3.x.x is not supported), and run npm config set python python2.7
    2. Launch cmd, and set msvs_version according to your visual studio version 2013,2015,2017 npm config set msvs_version 2015

Installation

Now you can install zeromq with the following:

npm install zeromq@5

Installation - Contributors and Development

To set up zeromq for development, fork this repository and clone your fork to your system.

Make sure you have the required dependencies for building zeromq from source installed.

Install a development version of zeromq with the following:

npm install

Testing

Run the test suite using:

npm test

Running an example application

Several example applications are found in the examples directory. Use node to run an example. To run the 'subber' application, enter the following:

node examples/subber.js

Examples using zeromq

Push/Pull

This example demonstrates how a producer pushes information onto a socket and how a worker pulls information from the socket.

producer.js

// producer.js
var zmq = require('zeromq')
  , sock = zmq.socket('push');

sock.bindSync('tcp://127.0.0.1:3000');
console.log('Producer bound to port 3000');

setInterval(function(){
  console.log('sending work');
  sock.send('some work');
}, 500);

worker.js

// worker.js
var zmq = require('zeromq')
  , sock = zmq.socket('pull');

sock.connect('tcp://127.0.0.1:3000');
console.log('Worker connected to port 3000');

sock.on('message', function(msg){
  console.log('work: %s', msg.toString());
});

Pub/Sub

This example demonstrates using zeromq in a classic Pub/Sub, Publisher/Subscriber, application.

Publisher: pubber.js

// pubber.js
var zmq = require('zeromq')
  , sock = zmq.socket('pub');

sock.bindSync('tcp://127.0.0.1:3000');
console.log('Publisher bound to port 3000');

setInterval(function(){
  console.log('sending a multipart message envelope');
  sock.send(['kitty cats', 'meow!']);
}, 500);

Subscriber: subber.js

// subber.js
var zmq = require('zeromq')
  , sock = zmq.socket('sub');

sock.connect('tcp://127.0.0.1:3000');
sock.subscribe('kitty cats');
console.log('Subscriber connected to port 3000');

sock.on('message', function(topic, message) {
  console.log('received a message related to:', topic, 'containing message:', message);
});

For maintainers: Creating a release

When making a release, do the following:

npm version minor && git push && git push --tags

Then, wait for the prebuilds to get uploaded for each OS. After the prebuilds are uploaded, run the following to publish the release:

npm publish

Background

This codebase largely came from the npm module zmq and was, at one point, named nteract/zmq-prebuilt. It started as a community run fork of zmq that fixed up the build process and automated prebuilt binaries. In the process of setting up a way to do statically compiled binaries of zeromq for node, zmq-static was created. Eventually zmq-prebuilt was able to do the job of zmq-static and it was deprecated. Once zmq-prebuilt was shipping for a while, allowed building from source, and suggesting people use it for electron + node.js, the repository moved to the zeromq org and it became official.