{"maintainers":[{"name":"anonymous","email":"hello@indigounited.com"},{"name":"anonymous","email":"marcooliveira@me.com"}],"keywords":["ØMQ","0mq","zeromq","cluster","mq","message","queue","nodes","distributed"],"dist-tags":{"latest":"0.1.2"},"author":{"name":"Indigo United"},"description":"Distributed pub/sub based in ØMQ","readme":"# 1 ( *One* )\n\nDistributed pub/sub based in [ØMQ](http://www.zeromq.org/).\n\n*1* (pronounced One) is a sort of magnet module, gluing together all the nodes that you launch in a network, and providing a simple pub/sub. It allows you to separate several services in the same network by means of \n\n\n## Installation\n\nBefore you install the module through NPM, using `npm install 1`, make sure you\ntake care of the instructions below.\n\nThe first thing to do, is to install ØMQ. Head to\n[http://www.zeromq.org/intro:get-the-software](http://www.zeromq.org/intro:get-the-software)\nand follow the instructions for your operating system. Then, use\nthe instructions below, once again, depending on your operating system.\n\nAlso, you might want to tune your OS in order to solve some known\nissues with default configurations. To do this, head out to\n[http://www.zeromq.org/docs:tuning-zeromq](http://www.zeromq.org/docs:tuning-zeromq),\nand follow the instructions.\n\n**Note:** If you are installing on a system that is not covered by these\ninstructions, and manage to install, please share your instructions, so we can\nimprove the documentation.\n\n\n### Linux\n\nInstalling on debian-like operating systems, requires that you run the\nfollowing:\n\n```\n# apt-get install libavahi-compat-libdnssd-dev libc-ares2 libzmq-dev\n```\n\n\n### MacOS X\n\nYou will need [XCode command line tools](http://developer.apple.com/library/ios/#documentation/DeveloperTools/Conceptual/WhatsNewXcode/Articles/xcode_4_3.html)\nto install *One* on MacOS X, since it depends on\n[mdns](https://npmjs.org/package/mdns) and [zmq](https://npmjs.org/package/zmq).\n\n\n## Getting started\n\n```js\nvar One = require('1');\n\nvar one = new One();\n\n// Let's do something when we receive messages.\none.on('message', function (chan, msg) {\n    console.info(chan + '>', msg);\n});\n\n// Join the cluster.\none.join(function (err, cluster) {\n    err && throw new Error('Unable to join cluster: ' + err);\n\n    // Advertise the service.\n    one.advertise(function (err, adInfo) {\n        err && throw new Error('Unable to advertise service: ' + err);\n\n        // Subscribe a channel\n        one.subscribe('some_channel', function (err, chan) {\n            err && throw new Error('Unable to subscribe channel: ' + err);\n\n            // Let's send a message to the channel periodically\n            setTimeout(function () {\n                one.publish('some_channel', 'You will be notified of this message');\n\n                one.publish('some_channel_you_did_not_subscribe', 'You will not get this message');\n            }, 500);\n        });\n    });\n});\n```\n\nHere's a more elaborate way of instantiating One, with a few extra options:\n\n```js\n// You can pass a few options when instantiating One.\n// Note that these are all optional, and you can instantiate without any option.\n// The example below shows all the default options.\nvar one = new One({\n    // Id of the service you will be providing.\n    service: 'unnamedService',\n\n    // Cluster which this node belongs to.\n    cluster: 'defaultCluster',\n\n    // Id of this node. If null, a random id is generated.\n    id:      null,\n\n    // Port used for publishing messages. If null, a free random port is used.\n    port:    null,\n\n    // Interface in which the node will bind.\n    address: '0.0.0.0'\n});\n```\n\n## Reference\n\n### Introduction\n\nThis module can be used to easily create auto discoverable services that communicate through means of a distributed pub/sub. Unlike solutions based on Redis or some message queueing software, this module is based on 0MQ, enabling you to create a pub/sub without a single point of failure or bottleneck. \n\n### Advertising service\n\nUpon instantiation of *One*, you can specify the `service` which you are providing. This acts as an immediate identifier in case you create multiple service types that you don't want talking to each other. Only after you start advertising other nodes in the cluster will realise you have joined and listen to you. Until that moment, you are a silent node, which is only capable of listening.\n\nUsage:\n\n```js\nvar one = new One({\n    service: 'myStorageService'\n});\n\n// ...\n\n// Advertising service\none.advertise(function (err, adInfo) {\n    !err && console.log('Advertising', adInfo);\n});\n\n// ...\n\n// Stopping advertisement\none.stopAdvertise(function (err, adInfo) {\n    !err && console.log('Stopped advertising', adInfo);\n});\n\n```\n\n### Clustering\n\nUnlike `service`, clustering allows you to partition multiple nodes of the same service in the same network. Basically, only nodes belonging to the same `cluster` will talk to each other.\n\nUsage:\n\n```js\nvar one = new One({\n    service: 'myStorageService',\n    cluster: 'cluster1'\n});\n\n// Joining cluster\none.join(function (err, cluster) {\n    !err && console.log('Joined', cluster);\n});\n\n// ...\n\n// Leaving cluster\none.leave(function (err, cluster) {\n    !err && console.log('Left', cluster);\n});\n```\n\n### Events\n\nHere's a complete list of the available events that you can listen to:\n\n```js\none.on('join', function (cluster) {\n    console.log('joined cluster:', cluster);\n});\n\none.on('leave', function (cluster) {\n    console.log('left cluster:', cluster);\n});\n\none.on('advertise_start', function (adInfo) {\n    console.log('started advertising:', adInfo);\n});\n\none.on('advertise_stop', function (adInfo) {\n    console.log('stopped advertising:', adInfo);\n});\n\none.on('subscribe', function (channel) {\n    console.log('subscribed:', channel);\n});\n\none.on('unsubscribe', function (channel) {\n    console.log('unsubscribed:', channel);\n});\n\none.on('node_up', function (node) {\n    console.log('node up:', node);\n});\n\none.on('node_down', function (node) {\n    console.log('node down:', node);\n});\n\none.on('message', function (chan, payload) {\n    console.log(chan + '>', payload);\n});\n\n// Note that the error event is only emitted if you do not specify a callback to\n// a method that throws an error.\none.on('error', function (err) {\n    console.error('ERROR: ', err);\n});\n```\n\n\n## License\n\nReleased under the [MIT License](http://www.opensource.org/licenses/mit-license.php).","repository":{"type":"git","url":"git://github.com/IndigoUnited/node-1.git"},"users":{},"bugs":{"url":"https://github.com/IndigoUnited/node-1/issues"},"license":"MIT","versions":{"0.1.2":{"name":"1","version":"0.1.2","description":"Distributed pub/sub based in ØMQ","main":"index.js","scripts":{"test":"mocha -R spec"},"repository":{"type":"git","url":"git://github.com/IndigoUnited/node-1.git"},"keywords":["ØMQ","0mq","zeromq","cluster","mq","message","queue","nodes","distributed"],"author":{"name":"Indigo United"},"license":"MIT","dependencies":{"mdns2":"~2.1.3","zmq":"~2.4.0","mout":"~0.2.0","node-uuid":"~1.4.0","async":"~0.1.22"},"devDependencies":{"mocha":"~1.8.1","expect.js":"~0.2.0"},"bugs":{"url":"https://github.com/IndigoUnited/node-1/issues"},"homepage":"https://github.com/IndigoUnited/node-1","_id":"1@0.1.2","dist":{"shasum":"c51d6dae34b8a0ba2034cf01dbadbfdfe44941ad","size":6939,"noattachment":false,"tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/1/-/1-0.1.2.tgz","integrity":"sha512-IPhsmGsZoQtPHGw5p+KEOqw5+u5AYYHeerS20n+h96LaoPqgFY5qWne8lwWnT/sYtFhHXyH0OPGQcJGfriWmJw=="},"_from":".","_npmVersion":"1.4.6","_npmUser":{"name":"anonymous","email":"marco@indigounited.com"},"maintainers":[{"name":"anonymous","email":"hello@indigounited.com"},{"name":"anonymous","email":"marcooliveira@me.com"}],"directories":{},"publish_time":1397000562636,"_hasShrinkwrap":false,"_cnpm_publish_time":1397000562636,"_cnpmcore_publish_time":"2021-12-17T00:19:17.501Z","contributors":[]},"0.1.0":{"name":"1","version":"0.1.0","description":"Distributed pub/sub based on ØMQ","main":"index.js","scripts":{"test":"mocha -R spec"},"repository":{"type":"git","url":"git://github.com/IndigoUnited/node-1.git"},"keywords":["ØMQ","0mq","zeromq","cluster","mq","message","queue","nodes","distributed"],"author":{"name":"Indigo United"},"license":"MIT","dependencies":{"mdns2":"~2.1.3","zmq":"~2.4.0","mout":"~0.2.0","node-uuid":"~1.4.0","async":"~0.1.22"},"devDependencies":{"mocha":"~1.8.1","expect.js":"~0.2.0"},"bugs":{"url":"https://github.com/IndigoUnited/node-1/issues"},"homepage":"https://github.com/IndigoUnited/node-1","_id":"1@0.1.0","dist":{"shasum":"d05d7e17a763cf062e840c0590f07b6fb059854d","size":7162,"noattachment":false,"tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/1/-/1-0.1.0.tgz","integrity":"sha512-pUsldQQr07+dtxc8qYHrXBWYSQneoSd8VU6xx/w48u1WcsjdVf5656j96wwWJB26Ef6LVyXaCyFVZztbdkXsqQ=="},"_from":".","_npmVersion":"1.3.17","_npmUser":{"name":"anonymous","email":"marco@indigounited.com"},"maintainers":[{"name":"anonymous","email":"hello@indigounited.com"},{"name":"anonymous","email":"marcooliveira@me.com"}],"directories":{},"publish_time":1392768167618,"_hasShrinkwrap":false,"_cnpm_publish_time":1392768167618,"_cnpmcore_publish_time":"2021-12-17T00:19:17.741Z","contributors":[]},"0.0.6":{"name":"1","version":"0.0.6","description":"distributed message queue based on ØMQ","main":"index.js","scripts":{"test":"mocha -R spec"},"repository":{"type":"git","url":"git://github.com/IndigoUnited/node-1.git"},"keywords":["ØMQ","0mq","zeromq","cluster","mq","message","queue","nodes","distributed"],"author":{"name":"Indigo United"},"license":"MIT","dependencies":{"mdns2":"~2.1.3","zmq":"~2.4.0","mout":"~0.2.0","node-uuid":"~1.4.0","async":"~0.1.22"},"devDependencies":{"mocha":"~1.8.1","expect.js":"~0.2.0"},"bugs":{"url":"https://github.com/IndigoUnited/node-1/issues"},"homepage":"https://github.com/IndigoUnited/node-1","_id":"1@0.0.6","dist":{"shasum":"cdc1dbdc87fe0978a8f2e906ec735493efe9a3c6","size":6115,"noattachment":false,"tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/1/-/1-0.0.6.tgz","integrity":"sha512-/d4Uprdbhll6DlxEmEObZljC2/XN7uPrxJvszKwyrjryMOxeLjSHyFDITVmbdid/6Cgx9OxVQUaIKTQW6xrbWg=="},"_from":".","_npmVersion":"1.3.17","_npmUser":{"name":"anonymous","email":"marco@indigounited.com"},"maintainers":[{"name":"anonymous","email":"hello@indigounited.com"},{"name":"anonymous","email":"marcooliveira@me.com"}],"directories":{},"publish_time":1392743903443,"_hasShrinkwrap":false,"_cnpm_publish_time":1392743903443,"_cnpmcore_publish_time":"2021-12-17T00:19:17.961Z","contributors":[]},"0.0.5":{"name":"1","version":"0.0.5","description":"distributed message queue based on ØMQ","main":"index.js","scripts":{"test":"mocha -R spec"},"repository":{"type":"git","url":"git://github.com/IndigoUnited/node-1.git"},"keywords":["ØMQ","0mq","zeromq","cluster","mq","message","queue","nodes","distributed"],"author":{"name":"Indigo United"},"license":"MIT","dependencies":{"mdns":"https://github.com/agnat/node_mdns/tarball/master","zmq":"~2.4.0","mout":"~0.2.0","node-uuid":"~1.4.0","async":"~0.1.22"},"devDependencies":{"mocha":"~1.8.1","expect.js":"~0.2.0"},"bugs":{"url":"https://github.com/IndigoUnited/node-1/issues"},"_id":"1@0.0.5","dist":{"shasum":"1ca025e24da4eeb6353a8bf81099eb6809233e86","size":6083,"noattachment":false,"tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/1/-/1-0.0.5.tgz","integrity":"sha512-0i9kCpT6k/PNhh8eiBa8m8OKmLeXgdoxno996oCzhomsqztHi40l3TzRO7JGayo8qfbxm88fJ+RV3mW2LLfMrw=="},"_from":".","_npmVersion":"1.3.5","_npmUser":{"name":"anonymous","email":"marco@indigounited.com"},"maintainers":[{"name":"anonymous","email":"hello@indigounited.com"},{"name":"anonymous","email":"marcooliveira@me.com"}],"directories":{},"publish_time":1375718840787,"_hasShrinkwrap":false,"_cnpm_publish_time":1375718840787,"_cnpmcore_publish_time":"2021-12-17T00:19:18.165Z","contributors":[]},"0.0.4":{"name":"1","version":"0.0.4","description":"distributed message queue based on ØMQ","main":"index.js","scripts":{"test":"mocha -R spec"},"repository":{"type":"git","url":"git://github.com/IndigoUnited/node-1.git"},"keywords":["ØMQ","0mq","zeromq","cluster","mq","message","queue","nodes","distributed"],"author":{"name":"Indigo United"},"license":"MIT","dependencies":{"mdns":"https://github.com/agnat/node_mdns/tarball/master","zmq":"~2.2.0","mout":"~0.2.0","node-uuid":"~1.4.0","async":"~0.1.22"},"devDependencies":{"mocha":"~1.8.1","expect.js":"~0.2.0"},"readmeFilename":"README.md","bugs":{"url":"https://github.com/IndigoUnited/node-1/issues"},"_id":"1@0.0.4","dist":{"tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/1/-/1-0.0.4.tgz","shasum":"0f763f92bfa4fea3f8db6bae6a0fa51c79036fdc","size":6077,"noattachment":false,"integrity":"sha512-X5aPAd+hsoLsF7Zry57JUEulltdRITnjP9wUTsoH4HE5bZFOeHj0KzM3AsYxONrDlE0QHnZBj08bimkemmgh5w=="},"_from":".","_npmVersion":"1.3.5","_npmUser":{"name":"anonymous","email":"marco@indigounited.com"},"maintainers":[{"name":"anonymous","email":"hello@indigounited.com"},{"name":"anonymous","email":"marcooliveira@me.com"}],"directories":{},"publish_time":1375455003515,"_hasShrinkwrap":false,"_cnpm_publish_time":1375455003515,"_cnpmcore_publish_time":"2021-12-17T00:19:18.360Z","contributors":[]},"0.0.3":{"name":"1","version":"0.0.3","description":"distributed message queue based on ØMQ","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git@github.com:IndigoUnited/node-1.git"},"keywords":["ØMQ","0mq","zeromq","cluster","mq","message","queue","nodes","distributed"],"author":{"name":"Indigo United"},"license":"MIT","dependencies":{"mdns":"~1.1.0","zmq":"~2.2.0","mout":"~0.2.0","node-uuid":"~1.4.0","async":"~0.1.22"},"devDependencies":{"mocha":"~1.8.1","expect.js":"~0.2.0"},"readmeFilename":"README.md","_id":"1@0.0.3","dist":{"tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/1/-/1-0.0.3.tgz","shasum":"43b0628930e407015e07cc94cbcb217d90aa34a7","size":6139,"noattachment":false,"integrity":"sha512-BH0KQ9qiuPnNj6ZKhwaDy5q4BydnsS46joDXzTj1dRpSwTc1uOcpQa03GRPozJ7JdEmZGekUbhCcpUOjsM/g9w=="},"_from":".","_npmVersion":"1.2.11","_npmUser":{"name":"anonymous","email":"marco@indigounited.com"},"maintainers":[{"name":"anonymous","email":"hello@indigounited.com"},{"name":"anonymous","email":"marcooliveira@me.com"}],"directories":{},"publish_time":1363866990611,"_hasShrinkwrap":false,"_cnpm_publish_time":1363866990611,"_cnpmcore_publish_time":"2021-12-17T00:19:18.541Z","contributors":[]},"0.0.2":{"name":"1","version":"0.0.2","description":"Clustering module based on 0MQ","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git@github.com:IndigoUnited/node-1.git"},"keywords":["ØMQ","0mq","zeromq","cluster","mq","message","queue","nodes","distributed"],"author":{"name":"Indigo United"},"license":"MIT","dependencies":{"mdns":"~1.1.0","zmq":"~2.2.0","mout":"~0.2.0","node-uuid":"~1.4.0","async":"~0.1.22"},"readmeFilename":"README.md","_id":"1@0.0.2","dist":{"tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/1/-/1-0.0.2.tgz","shasum":"4bd1eef3106d561bc8c46d76eb84af881cc50851","size":5668,"noattachment":false,"integrity":"sha512-PB97yAYsD6biBTjkqaZZkV48oPjshh9mucAcyIkbpVe6k8Xb2W/051Qkhtawqert9+UzGpwFyMFhy9l71C4ogQ=="},"_npmVersion":"1.1.65","_npmUser":{"name":"anonymous","email":"marco@indigounited.com"},"maintainers":[{"name":"anonymous","email":"hello@indigounited.com"},{"name":"anonymous","email":"marcooliveira@me.com"}],"directories":{},"publish_time":1359595266159,"_hasShrinkwrap":false,"_cnpm_publish_time":1359595266159,"_cnpmcore_publish_time":"2021-12-17T00:19:18.764Z","contributors":[]},"0.0.1":{"name":"1","version":"0.0.1","description":"Clustering module based on 0MQ","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":"","keywords":["0mq","cluster","mq","queue","nodes"],"author":{"name":"Marco Oliveira"},"license":"MIT","readmeFilename":"README.md","_id":"1@0.0.1","dist":{"tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/1/-/1-0.0.1.tgz","shasum":"7f3e6c39dd7399afda862f8f740c3ae45bb9c37b","size":369,"noattachment":false,"integrity":"sha512-6IKNX8h28Z1lbJ29IHY8qMrGhy9ONkJ/tFcpS09bPQew3u9eXQO++LRfYTdW6MOMj6BnAxBW65qvEwEuTy/PYA=="},"_npmVersion":"1.1.65","_npmUser":{"name":"anonymous","email":"marco@indigounited.com"},"maintainers":[{"name":"anonymous","email":"hello@indigounited.com"},{"name":"anonymous","email":"marcooliveira@me.com"}],"directories":{},"publish_time":1358469230750,"_hasShrinkwrap":false,"_cnpm_publish_time":1358469230750,"_cnpmcore_publish_time":"2021-12-17T00:19:18.977Z","contributors":[]}},"name":"1","time":{"created":"2022-01-26T16:18:07.996Z","modified":"2026-04-01T11:28:48.069Z","0.1.2":"2014-04-08T23:42:42.636Z","0.1.0":"2014-02-19T00:02:47.618Z","0.0.6":"2014-02-18T17:18:23.443Z","0.0.5":"2013-08-05T16:07:20.787Z","0.0.4":"2013-08-02T14:50:03.515Z","0.0.3":"2013-03-21T11:56:30.611Z","0.0.2":"2013-01-31T01:21:06.159Z","0.0.1":"2013-01-18T00:33:50.750Z"},"readmeFilename":"","homepage":"https://github.com/IndigoUnited/node-1"}