{"name":"zmq","version":"2.9.0","description":"Bindings for node.js to zeromq","main":"index","repository":{"type":"git","url":"http://github.com/JustinTulloss/zeromq.node.git"},"dependencies":{"nan":"~1.3.0","bindings":"~1.1.1"},"devDependencies":{"should":"2.1.x","semver":"~4.1.1","mocha":"~1.13.0"},"engines":{"node":">=0.8"},"scripts":{"test":"make test","install":"node-gyp rebuild"},"keywords":["zeromq","zmq","0mq","ømq","libzmq","native","binding","addon"],"author":{"name":"Justin Tulloss","email":"justin.tulloss@gmail.com","url":"http://justin.harmonize.fm"},"contributors":[{"name":"Justin Tulloss","email":"justin.tulloss@gmail.com","url":"http://justin.harmonize.fm"},{"name":"Stéphan Kochen","email":"stephan@kochen.nl","url":"http://stephan.kochen.nl/"},{"name":"Mike Castleman","email":"m@mlcastle.net","url":"http://mlcastle.net/"},{"name":"Matt Crocker"},{"name":"Jeremy Barnes","email":"jeremy@barneso.com","url":"http://www.barneso.com/"},{"name":"Rick","email":"technoweenie@gmail.com","url":"http://techno-weenie.net/"},{"name":"Corey Jewett","url":"http://syntheticplayground.com/"},{"name":"Micheil Smith","email":"micheil@brandedcode.com","url":"http://brandedcode.com/"},{"name":"TJ Holowaychuk","email":"tj@vision-media.ca","url":"http://tjholowaychuk.com/"},{"name":"Ron Korving","url":"https://github.com/ronkorving"},{"name":"Mark Everitt","url":"http://qubyte.dyndns.org/"},{"name":"Aldis Andrejevs","url":"https://github.com/aaudis"},{"name":"Iskren Ivov Chernev","email":"iskren.chernev@gmail.com"},{"name":"Seth Fitzsimmons"},{"name":"Patrick Lucas"},{"name":"Alexander Simmerl","url":"https://github.com/xla"},{"name":"Ian Babrou"},{"name":"Niall O'Higgins"},{"name":"Brian White","url":"https://github.com/mscdex"},{"name":"Mathieu D'Amours","url":"https://github.com/matehat"},{"name":"Joshua Gourneau"},{"name":"Yaroslav Shirokov"},{"name":"Marc Harter","url":"https://github.com/wavded"},{"name":"John Sun","url":"https://github.com/freehaha"},{"name":"Alexey Kupershtokh","email":"alexey.kupershtokh@gmail.com"},{"name":"Jon Gretar Borgthorsson","url":"https://github.com/JonGretar"},{"name":"Brian Lalor","url":"https://github.com/blalor"},{"name":"Benjamin Byholm","url":"https://github.com/kkoopa"},{"name":"Alejandro","url":"https://github.com/Minjung"},{"name":"Eli Skeggs","email":"skeggse@gmail.com","url":"https://github.com/skeggse"}],"gypfile":true,"bugs":{"url":"https://github.com/JustinTulloss/zeromq.node/issues"},"_id":"zmq@2.9.0","dist":{"shasum":"1df702192dc929e61cf113cec4e9b4ea17feea0e","tarball":"http://registry-npm.ywwl.com/zmq/download/zmq-2.9.0.tgz","integrity":"sha512-X6SaKxX/CqO3XTiTqzgvy0AxOpCWzYFB6bjg+Ak248YHJMkhJrpJiFMa4yvb8kgDSltNk7IxeDXnTwwi+YtARg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDrVi3Hz7PofEOFMBt72r4RmXkAFBeU2hbk92RctJADYgIgdhXKscug6LHf6Zvp7wvwXLe5FZSHbhieGOBebgDUvu4="}],"size":385760,"noattachment":false,"key":"/zmq/-/zmq-2.9.0.tgz"},"_from":".","_npmVersion":"1.2.30","_npmUser":{"name":"ronkorving","email":"ron@ronkorving.nl"},"maintainers":[{"name":"justin","email":"justin.tulloss@gmail.com"},{"name":"tjholowaychuk","email":"tj@vision-media.ca"},{"name":"ronkorving","email":"ron@ronkorving.nl"}],"directories":{},"readme":"# zmq &nbsp;&nbsp;[![Build Status](https://travis-ci.org/JustinTulloss/zeromq.node.png)](https://travis-ci.org/JustinTulloss/zeromq.node) &nbsp;[![Build status](https://ci.appveyor.com/api/projects/status/n0h0sjs127eadfuo/branch/windowsbuild?svg=true)](https://ci.appveyor.com/project/reqshark/zeromq-node)\n\n[ØMQ](http://www.zeromq.org/) bindings for node.js.\n\n## Installation\n\n### on Windows:\nFirst install [Visual Studio](https://www.visualstudio.com/) and either\n[Node.js](https://nodejs.org/download/) or [io.js](https://iojs.org/dist/latest/).\n\nEnsure you're building zmq from a conservative location on disk, one without\nunusual characters or spaces, for example somewhere like: `C:\\sources\\myproject`.\n\nInstalling the ZeroMQ library is optional and not required on Windows. We\nrecommend running `npm install` and node executable commands from a\n[github for windows](https://windows.github.com/) shell or similar environment.\n\n### installing on Unix/POSIX (and osx):\n\nFirst install `pkg-config` and the [ZeroMQ library](http://www.zeromq.org/intro:get-the-software).\n\nThis module is compatible with ZeroMQ versions 2, 3 and 4. The installation\nprocess varies by platform, but headers are mandatory. Most Linux distributions\nprovide these headers with `-devel` packages like `zeromq-devel` or\n`zeromq3-devel`. Homebrew for OS X provides versions 4 and 3 with packages\n`zeromq` and `zeromq3`, respectively. A\n[Chris Lea PPA](https://launchpad.net/~chris-lea/+archive/ubuntu/zeromq)\nis available for Debian-like users who want a version newer than currently\nprovided by their distribution. Windows is supported but not actively\nmaintained.\n\nNote: For zap support with versions >=4 you need to have libzmq built and linked\nagainst libsodium. Check the [Travis configuration](.travis.yml) for a list of what is tested\nand therefore known to work.\n\n#### with your platform-specifics taken care of, install and use this module:\n\n    $ npm install zmq\n\n## Examples\n\n### Push/Pull\n\n```js\n// producer.js\nvar zmq = require('zmq')\n  , sock = zmq.socket('push');\n\nsock.bindSync('tcp://127.0.0.1:3000');\nconsole.log('Producer bound to port 3000');\n\nsetInterval(function(){\n  console.log('sending work');\n  sock.send('some work');\n}, 500);\n```\n\n```js\n// worker.js\nvar zmq = require('zmq')\n  , sock = zmq.socket('pull');\n\nsock.connect('tcp://127.0.0.1:3000');\nconsole.log('Worker connected to port 3000');\n\nsock.on('message', function(msg){\n  console.log('work: %s', msg.toString());\n});\n```\n\n### Pub/Sub\n\n```js\n// pubber.js\nvar zmq = require('zmq')\n  , sock = zmq.socket('pub');\n\nsock.bindSync('tcp://127.0.0.1:3000');\nconsole.log('Publisher bound to port 3000');\n\nsetInterval(function(){\n  console.log('sending a multipart message envelope');\n  sock.send(['kitty cats', 'meow!']);\n}, 500);\n```\n\n```js\n// subber.js\nvar zmq = require('zmq')\n  , sock = zmq.socket('sub');\n\nsock.connect('tcp://127.0.0.1:3000');\nsock.subscribe('kitty cats');\nconsole.log('Subscriber connected to port 3000');\n\nsock.on('message', function(topic, message) {\n  console.log('received a message related to:', topic, 'containing message:', message);\n});\n```\n## Monitoring\n\nYou can get socket state changes events by calling to the `monitor` function.\nThe supported events are (see ZMQ [docs](http://api.zeromq.org/4-2:zmq-socket-monitor) for full description):\n\n* connect - `ZMQ_EVENT_CONNECTED`\n* connect_delay - `ZMQ_EVENT_CONNECT_DELAYED`\n* connect_retry - `ZMQ_EVENT_CONNECT_RETRIED`\n* listen - `ZMQ_EVENT_LISTENING`\n* bind_error - `ZMQ_EVENT_BIND_FAILED`\n* accept - `ZMQ_EVENT_ACCEPTED`\n* accept_error - `ZMQ_EVENT_ACCEPT_FAILED`\n* close - `ZMQ_EVENT_CLOSED`\n* close_error - `ZMQ_EVENT_CLOSE_FAILED`\n* disconnect - `ZMQ_EVENT_DISCONNECTED`\n\nAll events get 2 arguments:\n\n* `fd` - The file descriptor of the underlying socket (if available)\n* `endpoint` - The underlying socket endpoint\n\nA special `monitor_error` event will be raised when there was an error in the monitoring process, after this event no more\nmonitoring events will be sent, you can try and call `monitor` again to restart the monitoring process.\n\n### monitor(interval, numOfEvents)\nWill create an inproc PAIR socket where zmq will publish socket state changes events, the events from this socket will\nbe read every `interval` (defaults to 10ms).\nBy default only 1 message will be read every interval, this can be configured by using the `numOfEvents` parameter,\nwhere passing 0 will read all available messages per interval.\n\n### unmonitor()\nStop the monitoring process\n\n### example\n\n```js\n// Create a socket\nvar zmq = require('zmq');\nsocket = zmq.socket('req');\n\n// Register to monitoring events\nsocket.on('connect', function(fd, ep) {console.log('connect, endpoint:', ep);});\nsocket.on('connect_delay', function(fd, ep) {console.log('connect_delay, endpoint:', ep);});\nsocket.on('connect_retry', function(fd, ep) {console.log('connect_retry, endpoint:', ep);});\nsocket.on('listen', function(fd, ep) {console.log('listen, endpoint:', ep);});\nsocket.on('bind_error', function(fd, ep) {console.log('bind_error, endpoint:', ep);});\nsocket.on('accept', function(fd, ep) {console.log('accept, endpoint:', ep);});\nsocket.on('accept_error', function(fd, ep) {console.log('accept_error, endpoint:', ep);});\nsocket.on('close', function(fd, ep) {console.log('close, endpoint:', ep);});\nsocket.on('close_error', function(fd, ep) {console.log('close_error, endpoint:', ep);});\nsocket.on('disconnect', function(fd, ep) {console.log('disconnect, endpoint:', ep);});\n\n// Handle monitor error\nsocket.on('monitor_error', function(err) {\n\tconsole.log('Error in monitoring: %s, will restart monitoring in 5 seconds', err);\n\tsetTimeout(function() { socket.monitor(500, 0); }, 5000);\n});\n\n// Call monitor, check for events every 500ms and get all available events.\nconsole.log('Start monitoring...');\nsocket.monitor(500, 0);\nsocket.connect('tcp://127.0.0.1:1234');\n\nsetTimeout(function() {\n\tconsole.log('Stop the monitoring...');\n\tsocket.unmonitor();\n}, 20000);\n\n```\n\n## Detaching from the event loop\nYou may temporarily disable polling on a specific ZMQ socket and let the node.js\nprocess to terminate without closing sockets explicitly by removing their event loop\nreferences.  Newly created sockets are already `ref()`-ed.\n\n### unref()\nDetach the socket from the main event loop of the node.js runtime.\nCalling this on already detached sockets is a no-op.\n\n### ref()\nAttach the socket to the main event loop.\nCalling this on already attached sockets is a no-op.\n\n### Example\n```js\nvar zmq = require('zmq');\nsocket = zmq.socket('sub');\nsocket.bindSync('tcp://127.0.0.1:1234');\nsocket.subscribe('');\nsocket.on('message', function(msg) { console.log(msg.toString(); });\n// Here blocks indefinitely unless interrupted.\n// Let it terminate after 1 second.\nsetTimeout(function() { socket.unref(); }, 1000);\n```\n\n## Running tests\n\n#### Install dev deps:\n```sh\n$ git clone https://github.com/JustinTulloss/zeromq.node.git zmq && cd zmq\n$ npm i\n```\n#### Build:\n```sh\n# on unix:\n$ make\n\n# building on windows:\n> npm i\n```\n#### Test:\n```sh\n# on unix:\n$ make test\n\n# testing on windows:\n> npm t\n```\n## Running benchmarks\n\nBenchmarks are available in the `perf` directory, and have been implemented\naccording to the zmq documentation:\n[How to run performance tests](http://www.zeromq.org/results:perf-howto)\n\nIn the following examples, the arguments are respectively:\n- the host to connect to/bind on\n- message size (in bytes)\n- message count\n\nYou can run a latency benchmark by running these two commands in two separate\nshells:\n\n```sh\nnode ./local_lat.js tcp://127.0.0.1:5555 1 100000\n```\n\n```sh\nnode ./remote_lat.js tcp://127.0.0.1:5555 1 100000\n```\n\nAnd you can run throughput tests by running these two commands in two\nseparate shells:\n\n```sh\nnode ./local_thr.js tcp://127.0.0.1:5555 1 100000\n```\n\n```sh\nnode ./remote_thr.js tcp://127.0.0.1:5555 1 100000\n```\n\nRunning `make perf` will run the commands listed above.\n","publish_time":1420429436085,"_cnpm_publish_time":1420429436085,"dist-tags":{"latest":"2.15.3"}}