{"_id":"@boneskull/ascoltatori","_rev":"4-32318c08200036e5cacf6a39c05abfcf","name":"@boneskull/ascoltatori","description":"ascoltatori w/ mqtt support only","dist-tags":{"latest":"5.0.1"},"versions":{"4.0.0":{"name":"@boneskull/ascoltatori","version":"4.0.0","description":"ascoltatori w/ mqtt support only","main":"index.js","scripts":{"test":"mocha --recursive --bail --reporter spec test --globals Promise","ci":"mocha --recursive --bail --watch test","coverage":"rm -rf coverage; istanbul cover _mocha -- --reporter spec --bail --globals Promise","publish-coverage":"(cat coverage/lcov.info | coveralls)","jshint-lib":"jshint lib/*.js","jshint-test":"jshint test/*.js"},"pre-commit":["jshint-lib","jshint-test","test"],"repository":{"type":"git","url":"git+https://github.com/mcollina/ascoltatori.git"},"bugs":{"url":"http://github.com/mcollina/ascoltatori/issues"},"keywords":["publish","subscribe","pubsub","rabbitmq","zeromq","0mq","mqtt","amqp","mosquitto","mongodb","mongo","kafka","pub","sub"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"license":"MIT","contributors":[{"name":"Filippo De Pretto","email":"filnik90@gmail.com"},{"name":"David Halls","email":"dave@davedoesdev.com"}],"devDependencies":{"mocha":"^3.0.0","chai":"^3.4.1","sinon":"^1.17.2","sinon-chai":"^2.8.0","optimist":"^0.6.1","dox-foundation":"^0.5.6","mosca":"2.1.0","jshint":"^2.8.0","istanbul":"^0.4.0","coveralls":"^2.11.4","pre-commit":"^1.1.2"},"dependencies":{"debug":"^2.2.0","uuid":"^3.0.0","qlobber":"~0.7.0","steed":"^1.1.3","eventemitter2":"^2.1.3","mqtt":"^2.3.0"},"gitHead":"10a4477ad0677b00b7ecf13e66205206a05a74ba","homepage":"https://github.com/mcollina/ascoltatori#readme","_id":"@boneskull/ascoltatori@4.0.0","_shasum":"ed4144b67c39730561a1ff2fdba2824e8da7bf1a","_from":".","_npmVersion":"4.4.0","_nodeVersion":"7.7.1","_npmUser":{"name":"boneskull","email":"boneskull@boneskull.com"},"dist":{"shasum":"ed4144b67c39730561a1ff2fdba2824e8da7bf1a","tarball":"https://registry.npmjs.org/@boneskull/ascoltatori/-/ascoltatori-4.0.0.tgz","integrity":"sha512-DOqWFzud3CV0sSlrUb3/D6Y30chsu1EjJyOoTgDxKLZMXC9kPrPHIkr6RNpeOibtQggmmcb6cA/H8Dw0gf4W1g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIA5WF3+i3Ug0FgehvjU5aqyhyt6jRoX4hBCNulf5sGtPAiEA37X292G0WZ9Kd/aq4+p14wpfdDRnWBrkuqLLGEM/5L4="}]},"maintainers":[{"name":"boneskull","email":"boneskull@boneskull.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/ascoltatori-4.0.0.tgz_1488695001236_0.5407726836856455"}},"5.0.0":{"name":"@boneskull/ascoltatori","version":"5.0.0","description":"ascoltatori w/ mqtt support only","main":"index.js","scripts":{"test":"mocha --recursive --bail --reporter spec test --globals Promise","ci":"mocha --recursive --bail --watch test","coverage":"rm -rf coverage; istanbul cover _mocha -- --reporter spec --bail --globals Promise","publish-coverage":"(cat coverage/lcov.info | coveralls)","jshint-lib":"jshint lib/*.js","jshint-test":"jshint test/*.js"},"pre-commit":["jshint-lib","jshint-test","test"],"repository":{"type":"git","url":"git+https://github.com/boneskull/ascoltatori.git"},"bugs":{"url":"http://github.com/mcollina/ascoltatori/issues"},"keywords":["publish","subscribe","pubsub","rabbitmq","zeromq","0mq","mqtt","amqp","mosquitto","mongodb","mongo","kafka","pub","sub"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"license":"MIT","contributors":[{"name":"Filippo De Pretto","email":"filnik90@gmail.com"},{"name":"David Halls","email":"dave@davedoesdev.com"}],"devDependencies":{"mocha":"^3.0.0","chai":"^3.4.1","sinon":"^1.17.2","sinon-chai":"^2.8.0","optimist":"^0.6.1","dox-foundation":"^0.5.6","mosca":"2.1.0","jshint":"^2.8.0","istanbul":"^0.4.0","coveralls":"^2.11.4","pre-commit":"^1.1.2"},"dependencies":{"debug":"^2.2.0","uuid":"^3.0.0","qlobber":"~0.7.0","steed":"^1.1.3","eventemitter2":"^2.1.3","mqtt":"^2.3.0"},"gitHead":"1154b86bdde7b1fdf34b082f3cf2779f8ebc26c7","homepage":"https://github.com/boneskull/ascoltatori#readme","_id":"@boneskull/ascoltatori@5.0.0","_shasum":"2db176589b7b6c15f99ad343dcfb96a48b43fd8b","_from":".","_npmVersion":"4.4.0","_nodeVersion":"7.7.1","_npmUser":{"name":"boneskull","email":"boneskull@boneskull.com"},"dist":{"shasum":"2db176589b7b6c15f99ad343dcfb96a48b43fd8b","tarball":"https://registry.npmjs.org/@boneskull/ascoltatori/-/ascoltatori-5.0.0.tgz","integrity":"sha512-Ra6zGGyFP394MwG6zrpMqMlYbTdxaBhp6KG/KSkMBwvpvO4P3FTifJ87fjaa/sOqV7R++6t+gCH9t4B8khcEdg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDbY6Qwv1PKUTVYCrBKui2GXOOtpxUOnvLi0iSDzN0ABgIhAL0lp3TA4ngHopFT2MN6/zGrBtgwEuEYZSVbSFDuchGU"}]},"maintainers":[{"name":"boneskull","email":"boneskull@boneskull.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/ascoltatori-5.0.0.tgz_1488695971185_0.6691924522165209"}},"5.0.1":{"name":"@boneskull/ascoltatori","version":"5.0.1","description":"ascoltatori w/ mqtt support only","main":"index.js","scripts":{"test":"mocha --recursive --bail --reporter spec test --globals Promise","ci":"mocha --recursive --bail --watch test","coverage":"rm -rf coverage; istanbul cover _mocha -- --reporter spec --bail --globals Promise","publish-coverage":"(cat coverage/lcov.info | coveralls)","jshint-lib":"jshint lib/*.js","jshint-test":"jshint test/*.js"},"pre-commit":["jshint-lib","jshint-test","test"],"repository":{"type":"git","url":"git+https://github.com/boneskull/ascoltatori.git"},"bugs":{"url":"http://github.com/mcollina/ascoltatori/issues"},"keywords":["publish","subscribe","pubsub","mqtt","mosquitto","pub","sub"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"license":"MIT","contributors":[{"name":"Filippo De Pretto","email":"filnik90@gmail.com"},{"name":"David Halls","email":"dave@davedoesdev.com"}],"devDependencies":{"mocha":"^3.0.0","chai":"^3.4.1","sinon":"^1.17.2","sinon-chai":"^2.8.0","optimist":"^0.6.1","dox-foundation":"^0.5.6","mosca":"2.1.0","jshint":"^2.8.0","istanbul":"^0.4.0","coveralls":"^2.11.4","pre-commit":"^1.1.2"},"dependencies":{"debug":"^2.2.0","uuid":"^3.0.0","qlobber":"~0.7.0","steed":"^1.1.3","eventemitter2":"^2.1.3","mqtt":"^2.3.0"},"gitHead":"47fa43b11a9fc8b774012b2c6ad1469b65d00b91","homepage":"https://github.com/boneskull/ascoltatori#readme","_id":"@boneskull/ascoltatori@5.0.1","_shasum":"20f2ac4bd733057b65fd0035b8d9d867f2cd4743","_from":".","_npmVersion":"4.4.0","_nodeVersion":"7.7.1","_npmUser":{"name":"boneskull","email":"boneskull@boneskull.com"},"dist":{"shasum":"20f2ac4bd733057b65fd0035b8d9d867f2cd4743","tarball":"https://registry.npmjs.org/@boneskull/ascoltatori/-/ascoltatori-5.0.1.tgz","integrity":"sha512-F1cR6U0SGyJFEjzTwpRAuzziS+o+QYtU/7XjYAmBmq6rmqESFZMavZWX2BHW/NrbmzVF+TbgXCjvdunkzSJsew==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAR9R4McUnToMaJ0jkNIgz9TDmULNnqGd/em6VPscR5EAiEA9TspGthS9AHDxZufoiTQYsRMUhQAcRqR0gJ3UzB8d3c="}]},"maintainers":[{"name":"boneskull","email":"boneskull@boneskull.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/ascoltatori-5.0.1.tgz_1488740196374_0.6308352649211884"}}},"readme":"Ascoltatori&nbsp;&nbsp;&nbsp;[![Build Status](https://travis-ci.org/mcollina/ascoltatori.png)](https://travis-ci.org/mcollina/ascoltatori) [![Coverage Status](https://coveralls.io/repos/mcollina/ascoltatori/badge.png?branch=master)](https://coveralls.io/r/mcollina/ascoltatori?branch=master)\n========================================\n\n> TIP: Ascoltatori is an italian word which means listeners.\nAn Ascoltatore is therefore a single listener.\n\nAscoltatori is a simple publish/subscribe library supporting the following brokers/protocols:\n\n* [Redis](http://redis.io/), a key/value store created by [@antirez](https://github.com/antirez).\n* [MongoDB](http://www.mongodb.org/), a scalable, high-performance, document-oriented database.\n* [Mosquitto](http://mosquitto.org/) and all implementations of the [MQTT](http://mqtt.org/) protocol.\n* [RabbitMQ](http://www.rabbitmq.com/) and all implementations of the [AMQP](http://www.amqp.org/) protocol.\n* [ZeroMQ](http://www.zeromq.org/) to use Ascoltatori in a P2P fashion.\n* [QlobberFSQ](https://github.com/davedoesdev/qlobber-fsq), a shared file system queue.\n* [Apache Kafka](http://kafka.apache.org), a high-throughput distributed messaging system.\n* Memory-only routing, using [Qlobber](https://github.com/davedoesdev/qlobber).\n\nFind out more about Ascoltatori reading the\n[dox generated documentation](http://mcollina.github.com/ascoltatori/docs/lib/ascoltatori.js.html)\n\n[![NPM](https://nodei.co/npm/ascoltatori.png)](https://nodei.co/npm/ascoltatori/)\n[![NPM](https://nodei.co/npm-dl/ascoltatori.png)](https://nodei.co/npm/ascoltatori/)\n\n## Install\n\nInstall the library using [npm](http://npmjs.org/).\n\n```\n$ npm install ascoltatori --save\n```\n\nInstall the library using git.\n\n```\n$ git clone git://github.com/mcollina/ascoltatori.git\n$ cd ascoltatori\n$ npm install\n```\n\n\n## Getting Started\n\nAscoltatori focuses on providing a simple and unique abstraction for all\nsupported brokers. Here is a simple example using Redis:\n\n```javascript\nvar ascoltatori = require('ascoltatori');\n\nascoltatori.build(function (err, ascoltatore) {\n\n  // subscribes to a topic\n  ascoltatore.subscribe('hello', function() {\n    console.log(arguments);\n    // { '0': 'hello', '1': 'a message' }\n  });\n\n  // publishes a message to the topic 'hello'\n  ascoltatore.publish('hello', 'a message', function() {\n    console.log('message published');\n  });\n});\n```\n\n\n## Wildcards\n\nAll ascoltatori support the use of wildcards, so everything\nshould work smoothly on every broker.\nYou might find some differences, and in that case file a bug\nreport, so we can fix them.\n\nThe wildcard character `+` matches exactly one word:\n\n```javascript\nvar ascoltatori = require('ascoltatori');\n\nascoltatori.build(function (err, ascoltatore) {\n\n  ascoltatore.subscribe(\"hello/+/world\", function() {\n    // this will print { '0': \"hello/there/world\", '1': \"a message\" }\n    console.log(arguments);\n  });\n\n  ascoltatore.subscribe(\"hello/+\", function() {\n    // this will not be called\n    console.log(arguments);\n  });\n\n  ascoltatore.publish(\"hello/there/world\", \"a message\", function() {\n    console.log(\"message published\");\n  });\n});\n```\n\nThe wildcard character `*` matches zero or more words:\n\n```javascript\nvar ascoltatori = require('ascoltatori');\n\nascoltatori.build(function (err, ascoltatore) {\n\n  ascoltatore.subscribe(\"hello/*\", function() {\n    // this will print { '0': \"hello/there/world\", '1': \"a message\" }\n    console.log(arguments);\n  });\n\n  ascoltatore.subscribe(\"*\", function() {\n    // this will print { '0': \"hello/there/world\", '1': \"a message\" }\n    console.log(arguments);\n  });\n\n  ascoltatore.subscribe(\"hello/there/world/*\", function() {\n    // this will print { '0': \"hello/there/world\", '1': \"a message\" }\n    console.log(arguments);\n  });\n\n  ascoltatore.publish(\"hello/there/world\", \"a message\", function() {\n    console.log(\"message published\");\n  });\n});\n```\n\nOf course, you can mix `*` and `+` in the same subscription:\n\n```javascript\nvar ascoltatori = require('ascoltatori');\n\nascoltatori.build(function (err, ascoltatore) {\n\n  ascoltatore.subscribe(\"hello/+/world/*\", function() {\n    // this will print { '0': \"hello/foo/world/bar/42\", '1': \"a message\" }\n    console.log(arguments);\n  });\n\n  ascoltatore.publish(\"hello/foo/world/bar/42\", \"a message\", function() {\n    console.log(\"message published\");\n  });\n});\n```\n\n\n## Brokers\n\nAscoltatori supports different brokers. Here we show how to use each of them.\n\n### Redis\n\n```javascript\nvar ascoltatori = require('ascoltatori');\nvar settings = {\n  type: 'redis',\n  redis: require('redis'),\n  db: 12,\n  port: 6379,\n  return_buffers: true, // to handle binary payloads\n  host: localhost\n};\n\nascoltatori.build(settings, function (err, ascoltatore) {\n  // ...\n});\n```\n\n### MongoDB\n\nMongoDB uses [Capped Collections](http://docs.mongodb.org/manual/core/capped-collections/) to implement the pub/sub pattern.\n\n```javascript\nvar ascoltatori = require('ascoltatori');\nvar settings = {\n  type: 'mongo',\n  url: 'mongodb://127.0.0.1/ascoltatori',\n  pubsubCollection: 'ascoltatori',\n  mongo: {} // mongo specific options\n};\n\nascoltatori.build(settings, function (err, ascoltatore) {\n  // ...\n});\n```\n\nIt is also possible to reuse an existing mongodb connection:\n\n```javascript\nvar ascoltatori = require('ascoltatori');\nvar MongoClient = require('mongodb').MongoClient;\n\nMongoClient.connect('mongodb://127.0.0.1/ascoltatori', {}, function (err, db) {\n  var settings = {\n    type: 'mongo',\n    db: db,\n    pubsubCollection: 'ascoltatori'\n  };\n  ascoltatori.build(settings, function (err, ascoltatore) {\n    // ...\n  });\n})\n```\n\n### MQTT (Mosquitto)\n\n```javascript\nvar ascoltatori = require('ascoltatori');\nsettings = {\n  type: 'mqtt',\n  json: false,\n  mqtt: require('mqtt'),\n  url: 'mqtt://127.0.0.1:1883'\n};\n\nascoltatori.build(settings, function (err, ascoltatore) {\n  // ...\n});\n```\n\n### AMQP (RabbitMQ)\n\n```javascript\nvar ascoltatori = require('ascoltatori');\nvar settings = {\n  type: 'amqp',\n  json: false,\n  amqp: require('amqp'),\n  exchange: 'ascolatore5672'\n};\n\nascoltatori.build(settings, function (err, ascoltatore) {\n  // ...\n});\n```\n\nUse with [amqplib](https://www.npmjs.com/package/amqplib)\n\n```javascript\nvar ascoltatori = require('ascoltatori');\nvar settings = {\n  type: 'amqplib',\n  json: false,\n  amqp: require('amqplib/callback_api'),\n  exchange: 'ascolatore5672'\n};\n\nascoltatori.build(settings, function (err, ascoltatore) {\n  // ...\n});\n```\n\n### ZeroMQ\n\n```javascript\nvar ascoltatori = require('ascoltatori');\nvar settings = {\n  type: 'zmq',\n  json: false,\n  zmq: require(\"zmq\"),\n  port: \"tcp://127.0.0.1:33333\",\n  controlPort: \"tcp://127.0.0.1:33334\",\n  delay: 10\n};\n\nascoltatori.build(settings, function (err, ascoltatore) {\n  // ...\n});\n```\n\n\n### QlobberFSQ\n\nYou can use any of the [QlobberFSQ constructor options](https://github.com/davedoesdev/qlobber-fsq#qlobberfsqoptions), for example:\n\n```javascript\nvar ascoltatori = require('ascoltatori');\nvar settings = {\n  type: 'filesystem',\n  json: false,\n  qlobber_fsq: require(\"qlobber-fsq\"),\n  fsq_dir: \"/shared/fsq\"\n};\n\nascoltatori.build(settings, function (err, ascoltatore) {\n  // ...\n});\n```\n\nIf you don't specify `fsq_dir` then messages will be written into a directory named `fsq` in the `qlobber-fsq` module directory.\n\n\n### Memory\n\n```javascript\nvar ascoltatori = require('ascoltatori');\nascoltatori.build(function (err, ascoltatore) {\n  // ...\n});\n```\n\n## JSON\n\nBy default, every ascoltatore built by the `ascoltatori.build` wraps every\npublished message in a JSON format. This behaviour can be triggered off by\npassing the `{ json: false }` option.\n\n```javascript\nrequire('ascoltatori').build({ json: false }, function(err, a) {\n  // ...\n});\n```\n\n### Apache Kafka\n\n```javascript\nvar ascoltatori = require('ascoltatori');\nvar settings = {\n  type: 'kafka',\n  json: false,\n  kafka: require(\"kafka-node\"),\n  connectionString: \"localhost:2181\",\n  clientId: \"ascoltatori\",\n  groupId: \"ascoltatori\",\n  defaultEncoding: \"utf8\",\n  encodings: {\n    image: \"buffer\"\n  }\n};\n\nascoltatori.build(settings, function (err, ascoltatore) {\n  // ...\n});\n```\n\nIf you publish to a kafka topic that doesn't exist, that topic will be created using the default settings.\n\nIf you subscribe to a kafka topic that doesn't exist, that subscription will take affect only when something is published to the kafka topic through this ascoltatori.\n\n\n## Debugging\n\nAscoltatori supports the [debug](https://github.com/visionmedia/debug) package\nand triggers the logs based on an external enviroment variable.\n\n```\n$ DEBUG=ascoltatori:mqtt node examples/mqtt_topic_bridge.js\n```\n\nThe following debug flags are supported:\n* `ascoltatori:amqp`\n* `ascoltatori:trie`\n* `ascoltatori:mqtt`\n* `ascoltatori:prefix`\n* `ascoltatori:redis`\n* `ascoltatori:zmq`\n* `ascoltatori:ee2`\n* `ascoltatori:filesystem`\n* `ascoltatori:kafka`\n\n\n## Reliability\n\nDue to the various transports Ascoltatori uses, it is impossible to\ngarantee one of the various reliability properties across all of the\ntransports. However, the MQTT and AMQP ascoltatori provides at-least-once\nsemantics, which means that the message might be received more than once,\nbut at least once.\n\n\n## Feedback\n\nUse the [issue tracker](http://github.com/mcollina/ascoltatori/issues) for bugs.\n[Tweet](http://twitter.com/matteocollina) us for any idea that can improve the project.\n\n\n## Links\n\n* [GIT Repository](http://github.com/mcollina/ascoltatori)\n* [Ascoltatori Documentation](http://mcollina.github.com/ascoltatori/docs/ascoltatori.js.html)\n* [Redis](http://redis.io/)\n* [MongoDB](http://www.mongodb.org/)\n* [Mosquitto](http://mosquitto.org/)\n* [RabbitMQ](http://www.rabbitmq.com/)\n* [ZeroMQ](http://www.zeromq.org/)\n* [Apache Kafka](http://kafka.apache.org/)\n\n\n## Authors\n\n* [Matteo Collina](http://twitter.com/matteocollina)\n* [David Halls](https://github.com/davedoesdev)\n\n\n## Contributors\n\nSpecial thanks to the [following people](https://github.com/mcollina/ascoltatori/contributors) for submitting patches.\n\n\n## LICENSE - \"MIT License\"\n\nCopyright (c) 2012-2015 Matteo Collina and Contributors, http://matteocollina.com\n\nPermission is hereby granted, free of charge, to any person\nobtaining a copy of this software and associated documentation\nfiles (the \"Software\"), to deal in the Software without\nrestriction, including without limitation the rights to use,\ncopy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the\nSoftware is furnished to do so, subject to the following\nconditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\nOF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\nHOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nWHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\nOTHER DEALINGS IN THE SOFTWARE.\n","maintainers":[{"name":"boneskull","email":"boneskull@boneskull.com"}],"time":{"modified":"2022-06-12T15:25:32.149Z","created":"2017-03-05T06:23:21.527Z","4.0.0":"2017-03-05T06:23:21.527Z","5.0.0":"2017-03-05T06:39:31.469Z","5.0.1":"2017-03-05T18:56:38.500Z"},"homepage":"https://github.com/boneskull/ascoltatori#readme","keywords":["publish","subscribe","pubsub","mqtt","mosquitto","pub","sub"],"repository":{"type":"git","url":"git+https://github.com/boneskull/ascoltatori.git"},"contributors":[{"name":"Filippo De Pretto","email":"filnik90@gmail.com"},{"name":"David Halls","email":"dave@davedoesdev.com"}],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"bugs":{"url":"http://github.com/mcollina/ascoltatori/issues"},"license":"MIT","readmeFilename":"README.md"}