{"_id":"mqtt-connection","_rev":"2993252","name":"mqtt-connection","description":"Stream-based Connection object for MQTT, extracted from MQTT.js","dist-tags":{"latest":"4.1.0"},"maintainers":[{"name":"matteo.collina","email":""}],"time":{"modified":"2023-08-28T09:18:41.000Z","created":"2014-12-19T11:16:51.866Z","4.1.0":"2021-02-22T09:30:12.039Z","4.0.0":"2018-06-08T18:47:10.696Z","3.2.0":"2017-10-17T07:54:48.029Z","3.1.0":"2017-05-15T13:23:44.401Z","3.0.0":"2016-09-28T12:25:03.286Z","2.1.1":"2015-01-13T09:28:07.937Z","2.1.0":"2015-01-09T23:32:13.263Z","2.0.0":"2015-01-09T17:53:47.580Z","1.0.3":"2015-01-08T22:30:05.792Z","1.0.2":"2014-12-23T23:42:18.015Z","1.0.1":"2014-12-19T11:18:34.656Z","1.0.0":"2014-12-19T11:16:51.866Z"},"users":{},"repository":{"type":"git","url":"git+https://github.com/mqttjs/mqtt-connection.git"},"versions":{"4.1.0":{"name":"mqtt-connection","version":"4.1.0","description":"Stream-based Connection object for MQTT, extracted from MQTT.js","main":"connection.js","contributors":[{"name":"Matteo Collina","email":"matteo.collina@gmail.com","url":"https://github.com/mcollina"},{"name":"Adam Rudd","email":"adamvrr@gmail.com"},{"name":"Siarhei Buntsevich","email":"scarry0506@gmail.com","url":"https://github.com/scarry1992"}],"scripts":{"test":"mocha test/ && standard"},"repository":{"type":"git","url":"git+https://github.com/mqttjs/mqtt-connection.git"},"keywords":["mqtt","connection","server"],"license":"MIT","bugs":{"url":"https://github.com/mqttjs/mqtt-connection/issues"},"homepage":"https://github.com/mqttjs/mqtt-connection","dependencies":{"duplexify":"^3.5.1","inherits":"^2.0.3","mqtt-packet":"^6.0.0","safe-buffer":"^5.1.1","through2":"^2.0.1"},"devDependencies":{"mocha":"^4.0.0","should":"^13.0.0","standard":"^11.0.0"},"gitHead":"a8246a0704fc1c83a7f407571d687025709cc3f8","_id":"mqtt-connection@4.1.0","_nodeVersion":"14.15.4","_npmVersion":"6.14.11","_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"dist":{"shasum":"9cbf57fe559f923a76608440a76f254a31bc2830","size":12048,"noattachment":false,"key":"/mqtt-connection/-/mqtt-connection-4.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/mqtt-connection/download/mqtt-connection-4.1.0.tgz"},"directories":{},"maintainers":[{"name":"matteo.collina","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mqtt-connection_4.1.0_1613986211928_0.28818308729187403"},"_hasShrinkwrap":false,"publish_time":1613986212039,"_cnpm_publish_time":1613986212039,"_cnpmcore_publish_time":"2021-12-16T14:27:32.056Z"},"4.0.0":{"name":"mqtt-connection","version":"4.0.0","description":"Stream-based Connection object for MQTT, extracted from MQTT.js","main":"connection.js","contributors":[{"name":"Matteo Collina","email":"matteo.collina@gmail.com","url":"https://github.com/mcollina"},{"name":"Adam Rudd","email":"adamvrr@gmail.com"},{"name":"Siarhei Buntsevich","email":"scarry0506@gmail.com","url":"https://github.com/scarry1992"}],"scripts":{"test":"mocha test/ && standard"},"repository":{"type":"git","url":"git+https://github.com/mqttjs/mqtt-connection.git"},"keywords":["mqtt","connection","server"],"license":"MIT","bugs":{"url":"https://github.com/mqttjs/mqtt-connection/issues"},"homepage":"https://github.com/mqttjs/mqtt-connection","dependencies":{"duplexify":"^3.5.1","inherits":"^2.0.3","mqtt-packet":"^6.0.0","safe-buffer":"^5.1.1","through2":"^2.0.1"},"devDependencies":{"mocha":"^4.0.0","should":"^13.0.0","standard":"^11.0.0"},"gitHead":"e47a4779332767b9e21f84e29b08fd79fd68a961","_id":"mqtt-connection@4.0.0","_npmVersion":"6.1.0","_nodeVersion":"8.11.2","_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"dist":{"shasum":"f171f08edb113c880c67d5cca29b081338139f1e","size":11718,"noattachment":false,"key":"/mqtt-connection/-/mqtt-connection-4.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/mqtt-connection/download/mqtt-connection-4.0.0.tgz"},"maintainers":[{"name":"matteo.collina","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mqtt-connection_4.0.0_1528483630582_0.29085669056805785"},"_hasShrinkwrap":false,"publish_time":1528483630696,"_cnpm_publish_time":1528483630696,"_cnpmcore_publish_time":"2021-12-16T14:27:32.278Z"},"3.2.0":{"name":"mqtt-connection","version":"3.2.0","description":"Stream-based Connection object for MQTT, extracted from MQTT.js","main":"connection.js","contributors":[{"name":"Matteo Collina","email":"matteo.collina@gmail.com","url":"https://github.com/mcollina"},{"name":"Adam Rudd","email":"adamvrr@gmail.com"}],"scripts":{"test":"mocha test/ && standard"},"repository":{"type":"git","url":"git+https://github.com/mqttjs/mqtt-connection.git"},"keywords":["mqtt","connection","server"],"license":"MIT","bugs":{"url":"https://github.com/mqttjs/mqtt-connection/issues"},"homepage":"https://github.com/mqttjs/mqtt-connection","dependencies":{"duplexify":"^3.5.1","inherits":"^2.0.3","mqtt-packet":"^5.4.0","safe-buffer":"^5.1.1","through2":"^2.0.1"},"devDependencies":{"mocha":"^4.0.0","should":"^13.0.0","standard":"^10.0.3"},"gitHead":"09bcbed38372c0cc53adca11744885fbafdc890d","_id":"mqtt-connection@3.2.0","_npmVersion":"5.5.1","_nodeVersion":"8.7.0","_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"dist":{"shasum":"2104d875ea917c46d25e89922c6694072910f408","size":10228,"noattachment":false,"key":"/mqtt-connection/-/mqtt-connection-3.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/mqtt-connection/download/mqtt-connection-3.2.0.tgz"},"maintainers":[{"name":"matteo.collina","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mqtt-connection-3.2.0.tgz_1508226887121_0.6235934398137033"},"directories":{},"publish_time":1508226888029,"_hasShrinkwrap":false,"_cnpm_publish_time":1508226888029,"_cnpmcore_publish_time":"2021-12-16T14:27:32.483Z"},"3.1.0":{"name":"mqtt-connection","version":"3.1.0","description":"Stream-based Connection object for MQTT, extracted from MQTT.js","main":"connection.js","contributors":[{"name":"Matteo Collina","email":"matteo.collina@gmail.com","url":"https://github.com/mcollina"},{"name":"Adam Rudd","email":"adamvrr@gmail.com"}],"scripts":{"test":"mocha test/ && standard"},"repository":{"type":"git","url":"git+https://github.com/mqttjs/mqtt-connection.git"},"keywords":["mqtt","connection","server"],"license":"MIT","bugs":{"url":"https://github.com/mqttjs/mqtt-connection/issues"},"homepage":"https://github.com/mqttjs/mqtt-connection","dependencies":{"duplexify":"^3.4.5","inherits":"^2.0.3","mqtt-packet":"^5.2.0","safe-buffer":"^5.0.1","through2":"^2.0.1"},"devDependencies":{"mocha":"^3.1.0","should":"^11.1.0","standard":"^10.0.0"},"gitHead":"8da8f33e2353666ef7581425bb66706f03df9342","_id":"mqtt-connection@3.1.0","_shasum":"c3547f99445e218d922c48c4beaec1b8c0806980","_from":".","_npmVersion":"4.5.0","_nodeVersion":"6.10.1","_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"dist":{"shasum":"c3547f99445e218d922c48c4beaec1b8c0806980","size":10463,"noattachment":false,"key":"/mqtt-connection/-/mqtt-connection-3.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/mqtt-connection/download/mqtt-connection-3.1.0.tgz"},"maintainers":[{"name":"matteo.collina","email":""}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/mqtt-connection-3.1.0.tgz_1494854622451_0.8400822044350207"},"directories":{},"publish_time":1494854624401,"_hasShrinkwrap":false,"_cnpm_publish_time":1494854624401,"_cnpmcore_publish_time":"2021-12-16T14:27:32.826Z"},"3.0.0":{"name":"mqtt-connection","version":"3.0.0","description":"Stream-based Connection object for MQTT, extracted from MQTT.js","main":"connection.js","contributors":[{"name":"Matteo Collina","email":"matteo.collina@gmail.com","url":"https://github.com/mcollina"},{"name":"Adam Rudd","email":"adamvrr@gmail.com"}],"scripts":{"test":"mocha test/"},"repository":{"type":"git","url":"git+https://github.com/mqttjs/mqtt-connection.git"},"keywords":["mqtt","connection","server"],"license":"MIT","bugs":{"url":"https://github.com/mqttjs/mqtt-connection/issues"},"homepage":"https://github.com/mqttjs/mqtt-connection","dependencies":{"duplexify":"^3.4.5","inherits":"^2.0.1","mqtt-packet":"^5.1.0","through2":"^2.0.1"},"devDependencies":{"mocha":"^3.0.2","should":"^11.1.0"},"gitHead":"7eae23f39e09c2e1afdcbe371d3fd4dc2ac5c662","_id":"mqtt-connection@3.0.0","_shasum":"3eac1cae9d4a36e5abcc24458ab5aba5e69ef949","_from":".","_npmVersion":"3.10.3","_nodeVersion":"6.7.0","_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"dist":{"shasum":"3eac1cae9d4a36e5abcc24458ab5aba5e69ef949","size":10323,"noattachment":false,"key":"/mqtt-connection/-/mqtt-connection-3.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/mqtt-connection/download/mqtt-connection-3.0.0.tgz"},"maintainers":[{"name":"matteo.collina","email":""}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/mqtt-connection-3.0.0.tgz_1475065502561_0.17780789802782238"},"directories":{},"publish_time":1475065503286,"_hasShrinkwrap":false,"_cnpm_publish_time":1475065503286,"_cnpmcore_publish_time":"2021-12-16T14:27:33.058Z"},"2.1.1":{"name":"mqtt-connection","version":"2.1.1","description":"Stream-based Connection object for MQTT, extracted from MQTT.js","main":"connection.js","contributors":[{"name":"Matteo Collina","email":"matteo.collina@gmail.com","url":"https://github.com/mcollina"},{"name":"Adam Rudd","email":"adamvrr@gmail.com"}],"scripts":{"test":"mocha test/"},"repository":{"type":"git","url":"https://github.com/mqttjs/mqtt-connection.git"},"keywords":["mqtt","connection","server"],"license":"MIT","bugs":{"url":"https://github.com/mqttjs/mqtt-connection/issues"},"homepage":"https://github.com/mqttjs/mqtt-connection","dependencies":{"inherits":"^2.0.1","mqtt-packet":"^3.0.0","reduplexer":"^1.1.0","through2":"^0.6.3"},"devDependencies":{"mocha":"^2.0.1","should":"^4.4.1"},"gitHead":"fe424bbc5075c6cf3908c056d38f59a9c5a5b6c3","_id":"mqtt-connection@2.1.1","_shasum":"7b2e985a74e196619430bebd35da162c34c4e56a","_from":".","_npmVersion":"2.1.10","_nodeVersion":"0.10.33","_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"maintainers":[{"name":"matteo.collina","email":""}],"dist":{"shasum":"7b2e985a74e196619430bebd35da162c34c4e56a","size":10062,"noattachment":false,"key":"/mqtt-connection/-/mqtt-connection-2.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/mqtt-connection/download/mqtt-connection-2.1.1.tgz"},"directories":{},"publish_time":1421141287937,"_hasShrinkwrap":false,"_cnpm_publish_time":1421141287937,"_cnpmcore_publish_time":"2021-12-16T14:27:33.361Z"},"2.1.0":{"name":"mqtt-connection","version":"2.1.0","description":"Stream-based Connection object for MQTT, extracted from MQTT.js","main":"connection.js","contributors":[{"name":"Matteo Collina","email":"matteo.collina@gmail.com","url":"https://github.com/mcollina"},{"name":"Adam Rudd","email":"adam.rudd@uqconnect.edu.au"}],"scripts":{"test":"mocha test/"},"repository":{"type":"git","url":"https://github.com/mqttjs/mqtt-connection.git"},"keywords":["mqtt","connection","server"],"license":"MIT","bugs":{"url":"https://github.com/mqttjs/mqtt-connection/issues"},"homepage":"https://github.com/mqttjs/mqtt-connection","dependencies":{"inherits":"^2.0.1","mqtt-packet":"^3.0.0","reduplexer":"^1.1.0","through2":"^0.6.3"},"devDependencies":{"mocha":"^2.0.1","should":"^4.4.1"},"gitHead":"739de0feb27890e68543769ba3cfe5f0ec7cc469","_id":"mqtt-connection@2.1.0","_shasum":"f31368ad7d4f836fc4ac536539f39c932b3d7e0d","_from":".","_npmVersion":"2.1.10","_nodeVersion":"0.10.33","_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"maintainers":[{"name":"matteo.collina","email":""}],"dist":{"shasum":"f31368ad7d4f836fc4ac536539f39c932b3d7e0d","size":10076,"noattachment":false,"key":"/mqtt-connection/-/mqtt-connection-2.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/mqtt-connection/download/mqtt-connection-2.1.0.tgz"},"directories":{},"publish_time":1420846333263,"_hasShrinkwrap":false,"_cnpm_publish_time":1420846333263,"_cnpmcore_publish_time":"2021-12-16T14:27:33.605Z"},"2.0.0":{"name":"mqtt-connection","version":"2.0.0","description":"Stream-based Connection object for MQTT, extracted from MQTT.js","main":"connection.js","contributors":[{"name":"Matteo Collina","email":"matteo.collina@gmail.com","url":"https://github.com/mcollina"},{"name":"Adam Rudd","email":"adam.rudd@uqconnect.edu.au"}],"scripts":{"test":"mocha test/"},"repository":{"type":"git","url":"https://github.com/mqttjs/mqtt-connection.git"},"keywords":["mqtt","connection","server"],"license":"MIT","bugs":{"url":"https://github.com/mqttjs/mqtt-connection/issues"},"homepage":"https://github.com/mqttjs/mqtt-connection","dependencies":{"inherits":"^2.0.1","mqtt-packet":"^3.0.0","reduplexer":"^1.1.0","through2":"^0.6.3"},"devDependencies":{"mocha":"^2.0.1","should":"^4.4.1"},"gitHead":"fb0e5b843fc79ff809b2472424ac87aec9d0041c","_id":"mqtt-connection@2.0.0","_shasum":"70a53addef03661b3135038e082862baeaf95e8f","_from":".","_npmVersion":"2.1.10","_nodeVersion":"0.10.33","_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"maintainers":[{"name":"matteo.collina","email":""}],"dist":{"shasum":"70a53addef03661b3135038e082862baeaf95e8f","size":9848,"noattachment":false,"key":"/mqtt-connection/-/mqtt-connection-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/mqtt-connection/download/mqtt-connection-2.0.0.tgz"},"directories":{},"publish_time":1420826027580,"_hasShrinkwrap":false,"_cnpm_publish_time":1420826027580,"_cnpmcore_publish_time":"2021-12-16T14:27:33.839Z"},"1.0.3":{"name":"mqtt-connection","version":"1.0.3","description":"Stream-based Connection object for MQTT, extracted from MQTT.js","main":"connection.js","contributors":[{"name":"Matteo Collina","email":"matteo.collina@gmail.com","url":"https://github.com/mcollina"},{"name":"Adam Rudd","email":"adam.rudd@uqconnect.edu.au"}],"scripts":{"test":"mocha test/"},"repository":{"type":"git","url":"https://github.com/mqttjs/mqtt-connection.git"},"keywords":["mqtt","connection","server"],"license":"MIT","bugs":{"url":"https://github.com/mqttjs/mqtt-connection/issues"},"homepage":"https://github.com/mqttjs/mqtt-connection","dependencies":{"inherits":"^2.0.1","mqtt-packet":"^2.0.0","reduplexer":"^1.1.0","through2":"^0.6.3"},"devDependencies":{"mocha":"^2.0.1","should":"^4.4.1"},"gitHead":"fdbcaf2d822cf4a2de6a6dcc55d4eedd5be67e47","_id":"mqtt-connection@1.0.3","_shasum":"bc3e986feb85fa477523949da449f6c4864f2534","_from":".","_npmVersion":"2.1.10","_nodeVersion":"0.10.33","_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"maintainers":[{"name":"matteo.collina","email":""}],"dist":{"shasum":"bc3e986feb85fa477523949da449f6c4864f2534","size":9982,"noattachment":false,"key":"/mqtt-connection/-/mqtt-connection-1.0.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/mqtt-connection/download/mqtt-connection-1.0.3.tgz"},"directories":{},"publish_time":1420756205792,"_hasShrinkwrap":false,"_cnpm_publish_time":1420756205792,"_cnpmcore_publish_time":"2021-12-16T14:27:34.060Z"},"1.0.2":{"name":"mqtt-connection","version":"1.0.2","description":"Stream-based Connection object for MQTT, extracted from MQTT.js","main":"connection.js","scripts":{"test":"mocha test/"},"repository":{"type":"git","url":"https://github.com/mcollina/mqtt-connection.git"},"keywords":["mqtt","connection","server"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"license":"MIT","bugs":{"url":"https://github.com/mcollina/mqtt-connection/issues"},"homepage":"https://github.com/mcollina/mqtt-connection","dependencies":{"inherits":"^2.0.1","mqtt-packet":"^2.0.0","reduplexer":"^1.1.0","through2":"^0.6.3"},"devDependencies":{"mocha":"^2.0.1","should":"^4.4.1"},"gitHead":"a817a20f62609d9e1fb8e39a4d10b34b2d1647d8","_id":"mqtt-connection@1.0.2","_shasum":"4c363debad6ff6b33b581b2b368e048b9e2d9082","_from":".","_npmVersion":"2.1.10","_nodeVersion":"0.10.33","_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"maintainers":[{"name":"matteo.collina","email":""}],"dist":{"shasum":"4c363debad6ff6b33b581b2b368e048b9e2d9082","size":9152,"noattachment":false,"key":"/mqtt-connection/-/mqtt-connection-1.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/mqtt-connection/download/mqtt-connection-1.0.2.tgz"},"directories":{},"publish_time":1419378138015,"_hasShrinkwrap":false,"_cnpm_publish_time":1419378138015,"_cnpmcore_publish_time":"2021-12-16T14:27:34.305Z"},"1.0.1":{"name":"mqtt-connection","version":"1.0.1","description":"Stream-based Connection object for MQTT, extracted from MQTT.js","main":"connection.js","scripts":{"test":"mocha test/"},"repository":{"type":"git","url":"https://github.com/mcollina/mqtt-connection.git"},"keywords":["mqtt","connection","server"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"license":"MIT","bugs":{"url":"https://github.com/mcollina/mqtt-connection/issues"},"homepage":"https://github.com/mcollina/mqtt-connection","dependencies":{"inherits":"^2.0.1","mqtt-packet":"^2.0.0","reduplexer":"^1.1.0"},"devDependencies":{"mocha":"^2.0.1","should":"^4.4.1","through2":"^0.6.3"},"gitHead":"07215ea27905902ba6346c51b8775fcabe7c635f","_id":"mqtt-connection@1.0.1","_shasum":"d4bb52384bda5da991d95f65a0785d6964b6adb2","_from":".","_npmVersion":"2.1.10","_nodeVersion":"0.10.33","_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"maintainers":[{"name":"matteo.collina","email":""}],"dist":{"shasum":"d4bb52384bda5da991d95f65a0785d6964b6adb2","size":8985,"noattachment":false,"key":"/mqtt-connection/-/mqtt-connection-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/mqtt-connection/download/mqtt-connection-1.0.1.tgz"},"directories":{},"publish_time":1418987914656,"_hasShrinkwrap":false,"_cnpm_publish_time":1418987914656,"_cnpmcore_publish_time":"2021-12-16T14:27:34.605Z"},"1.0.0":{"name":"mqtt-connection","version":"1.0.0","description":"Legacy MqttConnection from MQTT.js, with no backpressure!","main":"connection.js","scripts":{"test":"mocha test/"},"repository":{"type":"git","url":"https://github.com/mcollina/mqtt-connection.git"},"keywords":["mqtt","connection","server"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"license":"MIT","bugs":{"url":"https://github.com/mcollina/mqtt-connection/issues"},"homepage":"https://github.com/mcollina/mqtt-connection","dependencies":{"inherits":"^2.0.1","mqtt-packet":"^2.0.0","reduplexer":"^1.1.0"},"devDependencies":{"mocha":"^2.0.1","should":"^4.4.1","through2":"^0.6.3"},"gitHead":"18851b65ee5b48f3cfd32de4e955bf6ab6a2712f","_id":"mqtt-connection@1.0.0","_shasum":"65ad52afff6177f503e0eabea89e341ddd97422d","_from":".","_npmVersion":"2.1.10","_nodeVersion":"0.10.33","_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"maintainers":[{"name":"matteo.collina","email":""}],"dist":{"shasum":"65ad52afff6177f503e0eabea89e341ddd97422d","size":8994,"noattachment":false,"key":"/mqtt-connection/-/mqtt-connection-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/mqtt-connection/download/mqtt-connection-1.0.0.tgz"},"directories":{},"publish_time":1418987811866,"_hasShrinkwrap":false,"_cnpm_publish_time":1418987811866,"_cnpmcore_publish_time":"2021-12-16T14:27:34.841Z"}},"readme":"mqtt-connection&nbsp;&nbsp;&nbsp;[![Build Status](https://travis-ci.org/mqttjs/mqtt-connection.png)](https://travis-ci.org/mqttjs/mqtt-connection)\n===============\n\nBarebone Connection object for MQTT.\nWorks over any kind of binary Streams, TCP, TLS, WebSocket, ...\n\n[![JavaScript Style Guide](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)\n\nIt uses [mqtt-packet](http://npm.im/mqtt-packet) for generating and\nparsing MQTT packets. See it for the full documentations on the\npacket types.\n\n  * <a href=\"#installation\">Installation</a>\n  * <a href=\"#usage\">Usage</a>\n  * <a href=\"#api\">API</a>\n  * <a href=\"#contributing\">Contributing</a>\n  * <a href=\"#license\">License &amp; copyright</a>\n\nThis library is tested with node v4, v6 and v7. The last version to support\nolder versions of node was mqtt-connection@2.1.1.\n\nInstallation\n-------\n\n```sh\nnpm install mqtt-connection --save\n```\n\nUsage\n-----\n\nAs a client:\n\n```js\nvar net = require('net')\nvar mqttCon = require('mqtt-connection')\nvar stream = net.createConnection(1883, 'localhost')\nvar conn = mqttCon(stream)\n\n// conn is your MQTT connection!\n```\n\nAs a server:\n```js\nvar net = require('net')\nvar mqttCon = require('mqtt-connection')\nvar server = new net.Server()\n\nserver.on('connection', function (stream) {\n  var client = mqttCon(stream)\n\n  // client connected\n  client.on('connect', function (packet) {\n    // acknowledge the connect packet\n    client.connack({ returnCode: 0 });\n  })\n\n  // client published\n  client.on('publish', function (packet) {\n    // send a puback with messageId (for QoS > 0)\n    client.puback({ messageId: packet.messageId })\n  })\n\n  // client pinged\n  client.on('pingreq', function () {\n    // send a pingresp\n    client.pingresp()\n  });\n\n  // client subscribed\n  client.on('subscribe', function (packet) {\n    // send a suback with messageId and granted QoS level\n    client.suback({ granted: [packet.qos], messageId: packet.messageId })\n  })\n\n  // timeout idle streams after 5 minutes\n  stream.setTimeout(1000 * 60 * 5)\n\n  // connection error handling\n  client.on('close', function () { client.destroy() })\n  client.on('error', function () { client.destroy() })\n  client.on('disconnect', function () { client.destroy() })\n\n  // stream timeout\n  stream.on('timeout', function () { client.destroy(); })\n})\n\n// listen on port 1883\nserver.listen(1883)\n```\n\nAs a websocket server:\n\n```js\nvar websocket = require('websocket-stream')\nvar WebSocketServer = require('ws').Server\nvar Connection = require('mqtt-connection')\nvar server = http.createServer()\n\nvar wss = new WebSocketServer({server: server})\n\nif (handler) {\n  server.on('client', handler)\n}\n\nwss.on('connection', function (ws) {\n  var stream = websocket(ws)\n  var connection = new Connection(stream)\n\n  handle(connection)\n})\n\nfunction handle (conn) {\n  // handle the MQTT connection like\n  // the net example\n}\n```\n\nAPI\n---\n\n  * <a href=\"#connection\"><code>mqtt.<b>Connection()</b></code></a>\n  * <a href=\"#parseStream\"><code>mqtt.<b>parseStream()</b></code></a>\n  * <a href=\"#generateStream\"><code>mqtt.<b>generateStream()</b></code></a>\n\n---------------------------------\n\n<a name=\"connection\"></a>\n### new mqtt.Connection([options])\n\nCreates a new MQTT `Connection`.\n\nOptions:\n\n  * `notData`: do not listen to the `'data'` event, so that it can\n    respect backpressure. Pipe the `Connection` to another stream to\n    consume the packets. If this option is passed `true` the object will\n    emit no packet-related events.\n\n#### Connection#connect(options, [callback])\n\nSend a MQTT connect packet.\n\n`options` supports the following properties:\n\n* `protocolId`: Protocol ID, usually `MQIsdp`. `string`\n* `protocolVersion`: Protocol version, usually 3. `number`\n* `keepalive`: keepalive period in seconds. `number`\n* `clientId`: client ID. `string`\n* `will`: the client's will message options.\n`object` that supports the following properties:\n  * `topic`: the will topic. `string`\n  * `payload`: the will payload. `string`\n  * `qos`: will qos level. `number`\n  * `retain`: will retain flag. `boolean`\n  * `properties`: properties of will by MQTT 5.0:\n      * `willDelayInterval`: representing the Will Delay Interval in seconds `number`,\n      * `payloadFormatIndicator`: Will Message is UTF-8 Encoded Character Data or not `boolean`,\n      * `messageExpiryInterval`: value is the lifetime of the Will Message in seconds and is sent as the Publication Expiry Interval when the Server publishes the Will Message `number`,\n      * `contentType`: describing the content of the Will Message `string`,\n      * `responseTopic`: String which is used as the Topic Name for a response message `string`,\n      * `correlationData`: The Correlation Data is used by the sender of the Request Message to identify which request the Response Message is for when it is received `binary`,\n      * `userProperties`: The User Property is allowed to appear multiple times to represent multiple name, value pairs `object`\n* `properties`: properties MQTT 5.0.\n`object` that supports the following properties:\n    * `sessionExpiryInterval`: representing the Session Expiry Interval in seconds `number`,\n    * `receiveMaximum`: representing the Receive Maximum value `number`,\n    * `maximumPacketSize`: representing the Maximum Packet Size the Client is willing to accept `number`,\n    * `topicAliasMaximum`: representing the Topic Alias Maximum value indicates the highest value that the Client will accept as a Topic Alias sent by the Server `number`,\n    * `requestResponseInformation`: The Client uses this value to request the Server to return Response Information in the CONNACK `boolean`,\n    * `requestProblemInformation`: The Client uses this value to indicate whether the Reason String or User Properties are sent in the case of failures `boolean`,\n    * `userProperties`: The User Property is allowed to appear multiple times to represent multiple name, value pairs `object`,\n    * `authenticationMethod`: the name of the authentication method used for extended authentication `string`,\n    * `authenticationData`: Binary Data containing authentication data `binary`\n* `clean`: the 'clean start' flag. `boolean`\n* `username`: username for protocol v3.1. `string`\n* `password`: password for protocol v3.1. `string`\n\n#### Connection#connack(options, [callback])\nSend a MQTT connack packet.\n\n`options` supports the following properties:\n\n* `returnCode`: the return code of the connack, success is for MQTT < 5.0\n* `reasonCode`: suback Reason Code `number` MQTT 5.0\n* `properties`: properties MQTT 5.0.\n`object` that supports the following properties:\n    * `sessionExpiryInterval`: representing the Session Expiry Interval in seconds `number`,\n    * `receiveMaximum`: representing the Receive Maximum value `number`,\n    * `maximumQoS`: maximum qos supported by server `number`,\n    * `retainAvailable`: declares whether the Server supports retained messages `boolean`,\n    * `maximumPacketSize`: Maximum Packet Size the Server is willing to accept `number`,\n    * `assignedClientIdentifier`: Assigned Client Identifier `string`,\n    * `topicAliasMaximum`: representing the Topic Alias Maximum value indicates the highest value that the Client will accept as a Topic Alias sent by the Server `number`,\n    * `reasonString`: representing the reason associated with this response `string`,\n    * `userProperties`: The User Property is allowed to appear multiple times to represent multiple name, value pairs `object`,\n    * `wildcardSubscriptionAvailable`: this byte declares whether the Server supports Wildcard Subscriptions `boolean`\n    * `subscriptionIdentifiersAvailable`: declares whether the Server supports Subscription Identifiers `boolean`,\n    * `sharedSubscriptionAvailable`: declares whether the Server supports Shared Subscriptions `boolean`,\n    * `serverKeepAlive`: Keep Alive time assigned by the Server `number`,\n    * `responseInformation`: String which is used as the basis for creating a Response Topic `string`,\n    * `serverReference`: String which can be used by the Client to identify another Server to use `string`,\n    * `authenticationMethod`: the name of the authentication method used for extended authentication `string`,\n    * `authenticationData`: Binary Data containing authentication data `binary`\n\n#### Connection#publish(options, [callback])\nSend a MQTT publish packet.\n\n`options` supports the following properties:\n\n* `topic`: the topic to publish to. `string`\n* `payload`: the payload to publish, defaults to an empty buffer.\n`string` or `buffer`\n* `qos`: the quality of service level to publish on. `number`\n* `messageId`: the message ID of the packet,\nrequired if qos > 0. `number`\n* `retain`: retain flag. `boolean`\n* `properties`: `object`\n    * `payloadFormatIndicator`: Payload is UTF-8 Encoded Character Data or not `boolean`,\n    * `messageExpiryInterval`: the lifetime of the Application Message in seconds `number`,\n    * `topicAlias`: value that is used to identify the Topic instead of using the Topic Name `number`,\n    * `responseTopic`: String which is used as the Topic Name for a response message `string`,\n    * `correlationData`: used by the sender of the Request Message to identify which request the Response Message is for when it is received `binary`,\n    * `userProperties`: The User Property is allowed to appear multiple times to represent multiple name, value pairs `object`,\n    * `subscriptionIdentifier`: representing the identifier of the subscription `number`,\n    * `contentType`: String describing the content of the Application Message `string`\n\n#### Connection#puback #pubrec #pubcomp #unsuback(options, [callback])\nSend a MQTT `[puback, pubrec, pubcomp, unsuback]` packet.\n\n`options` supports the following properties:\n\n* `messageId`: the ID of the packet\n* `reasonCode`: Reason Code by packet `number`\n* `properties`: `object`\n    * `reasonString`: representing the reason associated with this response `string`,\n    * `userProperties`: The User Property is allowed to appear multiple times to represent multiple name, value pairs `object`\n\n#### Connection#pubrel(options, [callback])\nSend a MQTT pubrel packet.\n\n`options` supports the following properties:\n\n* `dup`: duplicate message flag\n* `reasonCode`: pubrel Reason Code `number`\n* `messageId`: the ID of the packet\n* `properties`: `object`\n    * `reasonString`: representing the reason associated with this response `string`,\n    * `userProperties`: The User Property is allowed to appear multiple times to represent multiple name, value pairs `object`\n\n#### Connection#subscribe(options, [callback])\nSend a MQTT subscribe packet.\n\n`options` supports the following properties:\n\n* `dup`: duplicate message flag\n* `messageId`: the ID of the packet\n* `properties`: `object`\n    * `subscriptionIdentifier`:  representing the identifier of the subscription `number`,\n    * `userProperties`: The User Property is allowed to appear multiple times to represent multiple name, value pairs `object`\n* `subscriptions`: a list of subscriptions of the form\n`[{topic: a, qos: 0}, {topic: b, qos: 1}]`\n`[{topic: a, qos: 0, nl: false, rap: true, rh: 15 }, {topic: b, qos: 1, nl: false, rap: false, rh: 100 }]` MQTT 5.0 Example\n\n#### Connection#suback(options, [callback])\nSend a MQTT suback packet.\n\n`options` supports the following properties:\n\n* `granted`: a vector of granted QoS levels,\nof the form `[0, 1, 2]`\n* `messageId`: the ID of the packet\n* `reasonCode`: suback Reason Code `number`\n* `properties`: `object`\n    * `reasonString`: representing the reason associated with this response `string`,\n    * `userProperties`: The User Property is allowed to appear multiple times to represent multiple name, value pairs `object`\n\n#### Connection#unsubscribe(options, [callback])\nSend a MQTT unsubscribe packet.\n\n`options` supports the following properties:\n\n* `messageId`: the ID of the packet\n* `reasonCode`: unsubscribe Reason Code MQTT 5.0 `number`\n* `dup`: duplicate message flag\n* `properties`: `object`\n    * `userProperties`: The User Property is allowed to appear multiple times to represent multiple name, value pairs `object`\n* `unsubscriptions`: a list of topics to unsubscribe from,\nof the form `[\"topic1\", \"topic2\"]`\n\n#### Connection#pingreq #pingresp #disconnect(options, [callback])\nSend a MQTT `[pingreq, pingresp]` packet.\n\n#### Connection#disconnect(options, [callback])\nSend a MQTT `disconnect` packet.\n\n`options` supports the following properties only MQTT 5.0:\n\n* `reasonCode`: Disconnect Reason Code `number`\n* `properties`: `object`\n    * `sessionExpiryInterval`: representing the Session Expiry Interval in seconds `number`,\n    * `reasonString`: representing the reason for the disconnect `string`,\n    * `userProperties`: The User Property is allowed to appear multiple times to represent multiple name, value pairs `object`,\n    * `serverReference`: String which can be used by the Client to identify another Server to use `string`\n\n#### Connection#auth(options, [callback])\nSend a MQTT `auth` packet. Only MQTT 5.0\n\n`options` supports the following properties only MQTT 5.0:\n\n* `reasonCode`: Auth Reason Code `number`\n* `properties`: `object`\n    * `authenticationMethod`: the name of the authentication method used for extended authentication `string`,\n    * `authenticationData`: Binary Data containing authentication data `binary`,\n    * `reasonString`: representing the reason for the disconnect `string`,\n    * `userProperties`: The User Property is allowed to appear multiple times to represent multiple name, value pairs `object`\n\n#### Event: 'connect'\n`function(packet) {}`\n\nEmitted when a MQTT connect packet is received by the client.\n\n`packet` is an object that may have the following properties:\n\n* `version`: the protocol version string\n* `versionNum`: the protocol version number\n* `keepalive`: the client's keepalive period\n* `clientId`: the client's ID\n* `will`: an object with the following keys:\n  * `topic`: the client's will topic\n  * `payload`: the will message\n  * `retain`: will retain flag\n  * `qos`: will qos level\n  * `properties`: properties of will\n* `properties`: properties of packet\n* `clean`: clean start flag\n* `username`: v3.1 username\n* `password`: v3.1 password\n\n#### Event: 'connack'\n`function(packet) {}`\n\nEmitted when a MQTT connack packet is received by the client.\n\n`packet` is an object that may have the following properties:\n\n* `returnCode`: the return code of the connack packet\n* `properties`: properties of packet\n\n#### Event: 'publish'\n`function(packet) {}`\n\nEmitted when a MQTT publish packet is received by the client.\n\n`packet` is an object that may have the following properties:\n\n* `topic`: the topic the message is published on\n* `payload`: the payload of the message\n* `messageId`: the ID of the packet\n* `properties`: properties of packet\n* `qos`: the QoS level to publish at\n\n#### Events: \\<'puback', 'pubrec', 'pubrel', 'pubcomp', 'unsuback'\\>\n`function(packet) {}`\n\nEmitted when a MQTT `[puback, pubrec, pubrel, pubcomp, unsuback]`\npacket is received by the client.\n\n`packet` is an object that may contain the property:\n\n* `messageId`: the ID of the packet\n* `properties`: properties of packet\n\n#### Event: 'subscribe'\n`function(packet) {}`\n\nEmitted when a MQTT subscribe packet is received.\n\n`packet` is an object that may contain the properties:\n\n* `messageId`: the ID of the packet\n* `properties`: properties of packet\n* `subscriptions`: an array of objects\nrepresenting the subscribed topics, containing the following keys\n  * `topic`: the topic subscribed to\n  * `qos`: the qos level of the subscription\n\n\n#### Event: 'suback'\n`function(packet) {}`\n\nEmitted when a MQTT suback packet is received.\n\n`packet` is an object that may contain the properties:\n\n* `messageId`: the ID of the packet\n* `properties`: properties of packet\n* `granted`: a vector of granted QoS levels\n\n#### Event: 'unsubscribe'\n`function(packet) {}`\n\nEmitted when a MQTT unsubscribe packet is received.\n\n`packet` is an object that may contain the properties:\n\n* `messageId`: the ID of the packet\n* `properties`: properties of packet\n* `unsubscriptions`: a list of topics the client is\nunsubscribing from, of the form `[topic1, topic2, ...]`\n\n#### Events: \\<'pingreq', 'pingresp'\\>\n`function(packet){}`\n\nEmitted when a MQTT `[pingreq, pingresp, disconnect]` packet is received.\n\n`packet` only includes static header information and can be ignored.\n\n#### Event: 'disconnect'\n`function(packet) {}`\n\nEmitted when a MQTT disconnect packet is received.\n\n`packet` only includes static header information and can be ignored for MQTT < 5.0.\n\n`packet` is an object that may contain the properties for MQTT 5.0:\n\n* `reasonCode`: disconnect Reason Code\n* `properties`: properties of packet\n\n#### Event: 'auth'\n`function(packet) {}`\n\nEmitted when a MQTT auth packet is received.\n\n`packet` is an object that may contain the properties:\n\n* `reasonCode`: Auth Reason Code\n* `properties`: properties of packet\n-------------------------------------\n\n<a name=\"generateStream\">\n\n### mqtt.generateStream()\n\nReturns a `Transform` stream that calls [`generate()`](https://github.com/mqttjs/mqtt-packet#generate).\nThe stream is configured into object mode.\n\n<a name=\"parseStream\">\n\n### mqtt.parseStream(opts)\n\nReturns a `Transform` stream that embeds a [`Parser`](https://github.com/mqttjs/mqtt-packet#mqttparser) and calls [`Parser.parse()`](https://github.com/mqttjs/mqtt-packet#parserparsebuffer) for each new `Buffer`. The stream is configured into object mode. It accepts the same options of [`parser(opts)`](#parser).\n\n<a name=\"contributing\"></a>\nContributing\n------------\n\nmqtt-connection is an **OPEN Open Source Project**. This means that:\n\n> Individuals making significant and valuable contributions are given commit-access to the project to contribute as they see fit. This project is more like an open wiki than a standard guarded open source project.\n\nSee the [CONTRIBUTING.md](https://github.com/mqttjs/mqtt-connection/blob/master/CONTRIBUTING.md) file for more details.\n\n### Contributors\n\nmqtt-connection is only possible due to the excellent work of the following contributors:\n\n<table><tbody>\n<tr><th align=\"left\">Matteo Collina</th><td><a href=\"https://github.com/mcollina\">GitHub/mcollina</a></td><td><a href=\"http://twitter.com/matteocollina\">Twitter/@matteocollina</a></td></tr>\n<tr><th align=\"left\">Adam Rudd</th><td><a href=\"https://github.com/adamvr\">GitHub/adamvr</a></td><td><a href=\"http://twitter.com/adam_vr\">Twitter/@adam_vr</a></td></tr>\n<tr><th align=\"left\">Siarhei Buntsevich</th><td><a href=\"https://github.com/scarry1992\">GitHub/scarry1992</a></td></tr>\n</tbody></table>\n\nLicense\n-------\n\nMIT\n","_attachments":{},"homepage":"https://github.com/mqttjs/mqtt-connection","bugs":{"url":"https://github.com/mqttjs/mqtt-connection/issues"},"license":"MIT"}