{"_id":"reconnect-core","_rev":"4221113","name":"reconnect-core","description":"Generic stream reconnection module.","dist-tags":{"latest":"1.3.0"},"maintainers":[{"name":"juliangruber","email":"julian@juliangruber.com"}],"time":{"modified":"2026-03-04T17:20:46.000Z","created":"2013-07-28T22:46:14.901Z","1.3.0":"2016-06-27T09:50:28.550Z","1.2.0":"2016-03-14T17:47:29.730Z","1.1.0":"2015-11-01T13:10:46.896Z","1.0.2":"2015-10-21T08:01:59.664Z","1.0.1":"2015-05-28T07:42:29.706Z","1.0.0":"2015-03-19T06:41:59.734Z","0.2.2":"2015-03-19T06:41:43.354Z","0.2.1":"2014-10-06T17:18:56.841Z","0.2.0":"2014-07-19T16:50:52.357Z","0.1.0":"2014-07-05T10:13:06.363Z","0.0.1":"2013-11-28T15:16:55.283Z","0.0.0":"2013-07-28T22:46:14.901Z"},"users":{},"author":{"name":"Julian Gruber","email":"mail@juliangruber.com","url":"http://juliangruber.com"},"repository":{"type":"git","url":"git://github.com/juliangruber/reconnect-core.git"},"versions":{"1.3.0":{"name":"reconnect-core","description":"Generic stream reconnection module.","version":"1.3.0","repository":{"type":"git","url":"git://github.com/juliangruber/reconnect-core.git"},"homepage":"https://github.com/juliangruber/reconnect-core","main":"index.js","scripts":{"test":"make test"},"dependencies":{"backoff":"~2.5.0"},"devDependencies":{"tape":"^4.6.0"},"keywords":["reconnect","core"],"author":{"name":"Julian Gruber","email":"mail@juliangruber.com","url":"http://juliangruber.com"},"license":"MIT","testling":{"files":"test/*.js","browsers":["ie/8..latest","firefox/17..latest","firefox/nightly","chrome/22..latest","chrome/canary","opera/12..latest","opera/next","safari/5.1..latest","ipad/6.0..latest","iphone/6.0..latest","android-browser/4.2..latest"]},"gitHead":"9a673043c72094b4ac0df567a97e356dd897bd79","bugs":{"url":"https://github.com/juliangruber/reconnect-core/issues"},"_id":"reconnect-core@1.3.0","_shasum":"fbae52919a7877d844e3246d01a2f26701c833c8","_from":".","_npmVersion":"3.9.3","_nodeVersion":"6.2.1","_npmUser":{"name":"juliangruber","email":"julian@juliangruber.com"},"dist":{"shasum":"fbae52919a7877d844e3246d01a2f26701c833c8","size":4750,"noattachment":false,"key":"/reconnect-core/-/reconnect-core-1.3.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/reconnect-core/download/reconnect-core-1.3.0.tgz"},"maintainers":[{"name":"juliangruber","email":"julian@juliangruber.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/reconnect-core-1.3.0.tgz_1467021026223_0.6667557661421597"},"directories":{},"publish_time":1467021028550,"_hasShrinkwrap":false,"_cnpm_publish_time":1467021028550,"_cnpmcore_publish_time":"2021-12-16T19:52:01.765Z"},"1.2.0":{"name":"reconnect-core","description":"Generic stream reconnection module.","version":"1.2.0","repository":{"type":"git","url":"git://github.com/juliangruber/reconnect-core.git"},"homepage":"https://github.com/juliangruber/reconnect-core","main":"index.js","scripts":{"test":"make test"},"dependencies":{"backoff":"~2.5.0"},"devDependencies":{"tape":"~4.5.0"},"keywords":["reconnect","core"],"author":{"name":"Julian Gruber","email":"mail@juliangruber.com","url":"http://juliangruber.com"},"license":"MIT","testling":{"files":"test/*.js","browsers":["ie/8..latest","firefox/17..latest","firefox/nightly","chrome/22..latest","chrome/canary","opera/12..latest","opera/next","safari/5.1..latest","ipad/6.0..latest","iphone/6.0..latest","android-browser/4.2..latest"]},"gitHead":"6fa3e17c237c36468a27adf9f35a4cc60e0d818f","bugs":{"url":"https://github.com/juliangruber/reconnect-core/issues"},"_id":"reconnect-core@1.2.0","_shasum":"2af25f6fe2f11f22819fcbf489c5168d496f0f0f","_from":".","_npmVersion":"3.3.12","_nodeVersion":"5.4.1","_npmUser":{"name":"juliangruber","email":"julian@juliangruber.com"},"dist":{"shasum":"2af25f6fe2f11f22819fcbf489c5168d496f0f0f","size":4376,"noattachment":false,"key":"/reconnect-core/-/reconnect-core-1.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/reconnect-core/download/reconnect-core-1.2.0.tgz"},"maintainers":[{"name":"juliangruber","email":"julian@juliangruber.com"}],"_npmOperationalInternal":{"host":"packages-13-west.internal.npmjs.com","tmp":"tmp/reconnect-core-1.2.0.tgz_1457977647555_0.4554273646790534"},"directories":{},"publish_time":1457977649730,"_hasShrinkwrap":false,"_cnpm_publish_time":1457977649730,"_cnpmcore_publish_time":"2021-12-16T19:52:02.261Z"},"1.1.0":{"name":"reconnect-core","description":"Generic stream reconnection module.","version":"1.1.0","repository":{"type":"git","url":"git://github.com/juliangruber/reconnect-core.git"},"homepage":"https://github.com/juliangruber/reconnect-core","main":"index.js","scripts":{"test":"make test"},"dependencies":{"backoff":"~2.3.0"},"devDependencies":{"tape":"~1.0.4"},"keywords":["reconnect","core"],"author":{"name":"Julian Gruber","email":"mail@juliangruber.com","url":"http://juliangruber.com"},"license":"MIT","testling":{"files":"test/*.js","browsers":["ie/8..latest","firefox/17..latest","firefox/nightly","chrome/22..latest","chrome/canary","opera/12..latest","opera/next","safari/5.1..latest","ipad/6.0..latest","iphone/6.0..latest","android-browser/4.2..latest"]},"gitHead":"5e711f8dafab78ff6b356cdfb32bd4b7ba6b6fc7","bugs":{"url":"https://github.com/juliangruber/reconnect-core/issues"},"_id":"reconnect-core@1.1.0","_shasum":"5bb360b35b197ea553f092b6057533aa41f2868c","_from":".","_npmVersion":"2.14.7","_nodeVersion":"4.2.1","_npmUser":{"name":"juliangruber","email":"julian@juliangruber.com"},"dist":{"shasum":"5bb360b35b197ea553f092b6057533aa41f2868c","size":4355,"noattachment":false,"key":"/reconnect-core/-/reconnect-core-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/reconnect-core/download/reconnect-core-1.1.0.tgz"},"maintainers":[{"name":"juliangruber","email":"julian@juliangruber.com"}],"directories":{},"publish_time":1446383446896,"_hasShrinkwrap":false,"_cnpm_publish_time":1446383446896,"_cnpmcore_publish_time":"2021-12-16T19:52:02.491Z"},"1.0.2":{"name":"reconnect-core","description":"Generic stream reconnection module.","version":"1.0.2","repository":{"type":"git","url":"git://github.com/juliangruber/reconnect-core.git"},"homepage":"https://github.com/juliangruber/reconnect-core","main":"index.js","scripts":{"test":"make test"},"dependencies":{"backoff":"~2.3.0"},"devDependencies":{"tape":"~1.0.4"},"keywords":["reconnect","core"],"author":{"name":"Julian Gruber","email":"mail@juliangruber.com","url":"http://juliangruber.com"},"license":"MIT","testling":{"files":"test/*.js","browsers":["ie/8..latest","firefox/17..latest","firefox/nightly","chrome/22..latest","chrome/canary","opera/12..latest","opera/next","safari/5.1..latest","ipad/6.0..latest","iphone/6.0..latest","android-browser/4.2..latest"]},"gitHead":"adb4e5c50708727ff261f7572452881a22210ca4","bugs":{"url":"https://github.com/juliangruber/reconnect-core/issues"},"_id":"reconnect-core@1.0.2","_shasum":"d43a684912b667aa64d8f5095e43272a004af50c","_from":".","_npmVersion":"2.14.7","_nodeVersion":"4.2.1","_npmUser":{"name":"juliangruber","email":"julian@juliangruber.com"},"dist":{"shasum":"d43a684912b667aa64d8f5095e43272a004af50c","size":4242,"noattachment":false,"key":"/reconnect-core/-/reconnect-core-1.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/reconnect-core/download/reconnect-core-1.0.2.tgz"},"maintainers":[{"name":"juliangruber","email":"julian@juliangruber.com"}],"directories":{},"publish_time":1445414519664,"_hasShrinkwrap":false,"_cnpm_publish_time":1445414519664,"_cnpmcore_publish_time":"2021-12-16T19:52:02.692Z"},"1.0.1":{"name":"reconnect-core","description":"Generic stream reconnection module.","version":"1.0.1","repository":{"type":"git","url":"git://github.com/juliangruber/reconnect-core.git"},"homepage":"https://github.com/juliangruber/reconnect-core","main":"index.js","scripts":{"test":"make test"},"dependencies":{"backoff":"~2.3.0"},"devDependencies":{"tape":"~1.0.4"},"keywords":["reconnect","core"],"author":{"name":"Julian Gruber","email":"mail@juliangruber.com","url":"http://juliangruber.com"},"license":"MIT","testling":{"files":"test/*.js","browsers":["ie/8..latest","firefox/17..latest","firefox/nightly","chrome/22..latest","chrome/canary","opera/12..latest","opera/next","safari/5.1..latest","ipad/6.0..latest","iphone/6.0..latest","android-browser/4.2..latest"]},"gitHead":"005c312b281ee186b95865bbd98e0784324d5e72","bugs":{"url":"https://github.com/juliangruber/reconnect-core/issues"},"_id":"reconnect-core@1.0.1","_shasum":"f8006105c304dbd1502613fa8e768e8a806b21bb","_from":".","_npmVersion":"2.6.1","_nodeVersion":"0.10.36","_npmUser":{"name":"juliangruber","email":"julian@juliangruber.com"},"maintainers":[{"name":"juliangruber","email":"julian@juliangruber.com"}],"dist":{"shasum":"f8006105c304dbd1502613fa8e768e8a806b21bb","size":4231,"noattachment":false,"key":"/reconnect-core/-/reconnect-core-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/reconnect-core/download/reconnect-core-1.0.1.tgz"},"directories":{},"publish_time":1432798949706,"_hasShrinkwrap":false,"_cnpm_publish_time":1432798949706,"_cnpmcore_publish_time":"2021-12-16T19:52:03.028Z"},"1.0.0":{"name":"reconnect-core","description":"Generic stream reconnection module.","version":"1.0.0","repository":{"type":"git","url":"git://github.com/juliangruber/reconnect-core.git"},"homepage":"https://github.com/juliangruber/reconnect-core","main":"index.js","scripts":{"test":"make test"},"dependencies":{"backoff":"~2.3.0"},"devDependencies":{"tape":"~1.0.4"},"keywords":["reconnect","core"],"author":{"name":"Julian Gruber","email":"mail@juliangruber.com","url":"http://juliangruber.com"},"license":"MIT","testling":{"files":"test/*.js","browsers":["ie/8..latest","firefox/17..latest","firefox/nightly","chrome/22..latest","chrome/canary","opera/12..latest","opera/next","safari/5.1..latest","ipad/6.0..latest","iphone/6.0..latest","android-browser/4.2..latest"]},"gitHead":"557a3ad327b51441d2f8a6282e2bf33966877bfb","bugs":{"url":"https://github.com/juliangruber/reconnect-core/issues"},"_id":"reconnect-core@1.0.0","_shasum":"4442c957a359f530a45428d892ac4c90e83fd311","_from":".","_npmVersion":"2.6.1","_nodeVersion":"0.10.36","_npmUser":{"name":"juliangruber","email":"julian@juliangruber.com"},"maintainers":[{"name":"juliangruber","email":"julian@juliangruber.com"}],"dist":{"shasum":"4442c957a359f530a45428d892ac4c90e83fd311","size":4165,"noattachment":false,"key":"/reconnect-core/-/reconnect-core-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/reconnect-core/download/reconnect-core-1.0.0.tgz"},"directories":{},"publish_time":1426747319734,"_hasShrinkwrap":false,"_cnpm_publish_time":1426747319734,"_cnpmcore_publish_time":"2021-12-16T19:52:03.223Z"},"0.2.2":{"name":"reconnect-core","description":"Generic stream reconnection module.","version":"0.2.2","repository":{"type":"git","url":"git://github.com/juliangruber/reconnect-core.git"},"homepage":"https://github.com/juliangruber/reconnect-core","main":"index.js","scripts":{"test":"make test"},"dependencies":{"backoff":"~2.3.0"},"devDependencies":{"tape":"~1.0.4"},"keywords":["reconnect","core"],"author":{"name":"Julian Gruber","email":"mail@juliangruber.com","url":"http://juliangruber.com"},"license":"MIT","testling":{"files":"test/*.js","browsers":["ie/8..latest","firefox/17..latest","firefox/nightly","chrome/22..latest","chrome/canary","opera/12..latest","opera/next","safari/5.1..latest","ipad/6.0..latest","iphone/6.0..latest","android-browser/4.2..latest"]},"gitHead":"abbe65a3f637e6c4210b428cb5e946f99495919a","bugs":{"url":"https://github.com/juliangruber/reconnect-core/issues"},"_id":"reconnect-core@0.2.2","_shasum":"2924b62b341171cca6d0f6631f2dbcb239580763","_from":".","_npmVersion":"2.6.1","_nodeVersion":"0.10.36","_npmUser":{"name":"juliangruber","email":"julian@juliangruber.com"},"maintainers":[{"name":"juliangruber","email":"julian@juliangruber.com"}],"dist":{"shasum":"2924b62b341171cca6d0f6631f2dbcb239580763","size":4164,"noattachment":false,"key":"/reconnect-core/-/reconnect-core-0.2.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/reconnect-core/download/reconnect-core-0.2.2.tgz"},"directories":{},"publish_time":1426747303354,"_hasShrinkwrap":false,"_cnpm_publish_time":1426747303354,"_cnpmcore_publish_time":"2021-12-16T19:52:03.457Z"},"0.2.1":{"name":"reconnect-core","description":"Generic stream reconnection module.","version":"0.2.1","repository":{"type":"git","url":"git://github.com/juliangruber/reconnect-core.git"},"homepage":"https://github.com/juliangruber/reconnect-core","main":"index.js","scripts":{"test":"make test"},"dependencies":{"backoff":"~2.3.0"},"devDependencies":{"tape":"~1.0.4"},"keywords":["reconnect","core"],"author":{"name":"Julian Gruber","email":"mail@juliangruber.com","url":"http://juliangruber.com"},"license":"MIT","testling":{"files":"test/*.js","browsers":["ie/8..latest","firefox/17..latest","firefox/nightly","chrome/22..latest","chrome/canary","opera/12..latest","opera/next","safari/5.1..latest","ipad/6.0..latest","iphone/6.0..latest","android-browser/4.2..latest"]},"gitHead":"18d00f5893b33f2e642a164ca0d10473c29802cd","bugs":{"url":"https://github.com/juliangruber/reconnect-core/issues"},"_id":"reconnect-core@0.2.1","_shasum":"571d348321220f96f1e73e8df54b7198ecadb61e","_from":".","_npmVersion":"2.0.0-beta.3","_npmUser":{"name":"juliangruber","email":"julian@juliangruber.com"},"maintainers":[{"name":"juliangruber","email":"julian@juliangruber.com"}],"dist":{"shasum":"571d348321220f96f1e73e8df54b7198ecadb61e","size":4083,"noattachment":false,"key":"/reconnect-core/-/reconnect-core-0.2.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/reconnect-core/download/reconnect-core-0.2.1.tgz"},"directories":{},"publish_time":1412615936841,"_hasShrinkwrap":false,"_cnpm_publish_time":1412615936841,"_cnpmcore_publish_time":"2021-12-16T19:52:03.662Z"},"0.2.0":{"name":"reconnect-core","description":"Generic stream reconnection module.","version":"0.2.0","repository":{"type":"git","url":"git://github.com/juliangruber/reconnect-core.git"},"homepage":"https://github.com/juliangruber/reconnect-core","main":"index.js","scripts":{"test":"make test"},"dependencies":{"backoff":"~2.3.0"},"devDependencies":{"tape":"~1.0.4"},"keywords":["reconnect","core"],"author":{"name":"Julian Gruber","email":"mail@juliangruber.com","url":"http://juliangruber.com"},"license":"MIT","testling":{"files":"test/*.js","browsers":["ie/8..latest","firefox/17..latest","firefox/nightly","chrome/22..latest","chrome/canary","opera/12..latest","opera/next","safari/5.1..latest","ipad/6.0..latest","iphone/6.0..latest","android-browser/4.2..latest"]},"bugs":{"url":"https://github.com/juliangruber/reconnect-core/issues"},"_id":"reconnect-core@0.2.0","dist":{"shasum":"c259b9caaa83d8db88da29cc7420baca0aaa83ba","size":4039,"noattachment":false,"key":"/reconnect-core/-/reconnect-core-0.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/reconnect-core/download/reconnect-core-0.2.0.tgz"},"_from":".","_npmVersion":"1.3.22","_npmUser":{"name":"juliangruber","email":"julian@juliangruber.com"},"maintainers":[{"name":"juliangruber","email":"julian@juliangruber.com"}],"directories":{},"publish_time":1405788652357,"_hasShrinkwrap":false,"_cnpm_publish_time":1405788652357,"_cnpmcore_publish_time":"2021-12-16T19:52:03.858Z"},"0.1.0":{"name":"reconnect-core","description":"Generic stream reconnection module.","version":"0.1.0","repository":{"type":"git","url":"git://github.com/juliangruber/reconnect-core.git"},"homepage":"https://github.com/juliangruber/reconnect-core","main":"index.js","scripts":{"test":"make test"},"dependencies":{"backoff":"~2.3.0"},"devDependencies":{"tape":"~1.0.4"},"keywords":["reconnect","core"],"author":{"name":"Julian Gruber","email":"mail@juliangruber.com","url":"http://juliangruber.com"},"license":"MIT","testling":{"files":"test/*.js","browsers":["ie/8..latest","firefox/17..latest","firefox/nightly","chrome/22..latest","chrome/canary","opera/12..latest","opera/next","safari/5.1..latest","ipad/6.0..latest","iphone/6.0..latest","android-browser/4.2..latest"]},"bugs":{"url":"https://github.com/juliangruber/reconnect-core/issues"},"_id":"reconnect-core@0.1.0","dist":{"shasum":"59d5fbc5e9c5b7b6757e091d42fdea3b0c4378c9","size":3943,"noattachment":false,"key":"/reconnect-core/-/reconnect-core-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/reconnect-core/download/reconnect-core-0.1.0.tgz"},"_from":".","_npmVersion":"1.3.22","_npmUser":{"name":"juliangruber","email":"julian@juliangruber.com"},"maintainers":[{"name":"juliangruber","email":"julian@juliangruber.com"}],"directories":{},"publish_time":1404555186363,"_hasShrinkwrap":false,"_cnpm_publish_time":1404555186363,"_cnpmcore_publish_time":"2021-12-16T19:52:04.085Z"},"0.0.1":{"name":"reconnect-core","description":"Generic stream reconnection module.","version":"0.0.1","repository":{"type":"git","url":"git://github.com/juliangruber/reconnect-core.git"},"homepage":"https://github.com/juliangruber/reconnect-core","main":"index.js","scripts":{"test":"tape test/*.js"},"dependencies":{"backoff":"~2.3.0"},"devDependencies":{"tape":"~1.0.4"},"keywords":["reconnect","core"],"author":{"name":"Julian Gruber","email":"mail@juliangruber.com","url":"http://juliangruber.com"},"license":"MIT","testling":{"files":"test/*.js","browsers":["ie/8..latest","firefox/17..latest","firefox/nightly","chrome/22..latest","chrome/canary","opera/12..latest","opera/next","safari/5.1..latest","ipad/6.0..latest","iphone/6.0..latest","android-browser/4.2..latest"]},"readmeFilename":"README.md","bugs":{"url":"https://github.com/juliangruber/reconnect-core/issues"},"_id":"reconnect-core@0.0.1","dist":{"shasum":"da38b8f8a2abde09f803b3794236d3fcadd313b3","size":3634,"noattachment":false,"key":"/reconnect-core/-/reconnect-core-0.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/reconnect-core/download/reconnect-core-0.0.1.tgz"},"_from":".","_npmVersion":"1.3.11","_npmUser":{"name":"juliangruber","email":"julian@juliangruber.com"},"maintainers":[{"name":"juliangruber","email":"julian@juliangruber.com"}],"directories":{},"publish_time":1385651815283,"_hasShrinkwrap":false,"_cnpm_publish_time":1385651815283,"_cnpmcore_publish_time":"2021-12-16T19:52:04.275Z"},"0.0.0":{"name":"reconnect-core","description":"Generic stream reconnection module.","version":"0.0.0","repository":{"type":"git","url":"git://github.com/juliangruber/reconnect-core.git"},"homepage":"https://github.com/juliangruber/reconnect-core","main":"index.js","scripts":{"test":"tape test/*.js"},"dependencies":{"backoff":"~2.3.0"},"devDependencies":{"tape":"~1.0.4"},"keywords":["reconnect","core"],"author":{"name":"Julian Gruber","email":"mail@juliangruber.com","url":"http://juliangruber.com"},"license":"MIT","readmeFilename":"README.md","bugs":{"url":"https://github.com/juliangruber/reconnect-core/issues"},"_id":"reconnect-core@0.0.0","dist":{"shasum":"4376caea850c2a37abc009500af8e28862647a87","size":3235,"noattachment":false,"key":"/reconnect-core/-/reconnect-core-0.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/reconnect-core/download/reconnect-core-0.0.0.tgz"},"_from":".","_npmVersion":"1.3.5","_npmUser":{"name":"juliangruber","email":"julian@juliangruber.com"},"maintainers":[{"name":"juliangruber","email":"julian@juliangruber.com"}],"directories":{},"publish_time":1375051574901,"_hasShrinkwrap":false,"_cnpm_publish_time":1375051574901,"_cnpmcore_publish_time":"2021-12-16T19:52:04.482Z"}},"readme":"# reconnect-core\n\nGeneric stream reconnection module.\n\n[![build status](https://secure.travis-ci.org/juliangruber/reconnect-core.png)](http://travis-ci.org/juliangruber/reconnect-core)\n\n[![testling badge](https://ci.testling.com/juliangruber/reconnect-core.png)](https://ci.testling.com/juliangruber/reconnect-core)\n\n## Usage\n\nCreate a `reconnect` instance that keeps reconnecting over tcp:\n\n```js\nvar inject = require('reconnect-core');\nvar net = require('net');\n\n// build you own reconnect module\nvar reconnect = inject(function () {\n  // arguments are what you passed to .connect\n  // this is the reconnect instance\n  return net.connect.apply(null, arguments);\n});\n\nvar re = reconnect({\n  // all options are optional\n  initialDelay: 1e3,\n  maxDelay: 30e3,\n  strategy: 'fibonacci',      // available: fibonacci, exponential, or a custom backoff instance (see below)\n  failAfter: Infinity,\n  randomisationFactor: 0,\n  immediate: false\n}, function (stream) {\n  // stream = the stream you should consume\n})\n.on('connect', function (con) {\n  // con = underlying connection  \n})\n.on('reconnect', function (n, delay) {\n  // n = current number of reconnect  \n  // delay = delay used before reconnect\n})\n.on('disconnect', function (err) {\n  // err = possible error  \n})\n.on('error', function (err) {\n  // never forget\n})\n.connect(port)\n\n// disconnect\nre.disconnect();\n\n// ...or prevent reconnecting\nre.reconnect = false;\n\n// reset the internal backoff timer\nre.reset();\n```\n\n## Strategies\n\nreconnect utilises the [backoff](https://github.com/MathieuTurcotte/node-backoff) library to control backoff behaviour.\nThere are 2 options for choosing a strategy for your reconnect instance, pass one of the following to the `strategy` key when creating your instance:\n* Pass the string \"fibonacci\" or \"exponential\" to utilise these built-in backoff strategies, options passed to your reconnect instance will also be passed to these strategies.\n* Pass a Backoff instance, this allows you to customise your backoff strategy by implementing a [Backoff Strategy](https://github.com/MathieuTurcotte/node-backoff#interface-backoffstrategy).\n\nAn example using a custom strategy:\n```js\nvar inject = require('reconnect-core');\nvar backoff = require('backoff');\nvar net = require('net');\n\n// build you own reconnect module\nvar reconnect = inject(function () {\n  // arguments are what you passed to .connect\n  // this is the reconnect instance\n  return net.connect.apply(null, arguments);\n});\n\n// Reconnect every 10 seconds\nvar myStrategy = {\n  next: function() { return 10e3; },\n  reset: function() { }\n}\n\nvar re = reconnect({\n  strategy: new backoff.Backoff(myStrategy),\n  failAfter: Infinity,\n  immediate: false\n}, function (stream) {\n  // stream = the stream you should consume\n})\n```\n\n## Available implementations\n\n* tcp: [reconnect-net](https://github.com/juliangruber/reconnect-net)\n* engine.io/websockets: [reconnect-engine](https://github.com/juliangruber/reconnect-engine)\n\n## Installation\n\nWith [npm](https://npmjs.org) do:\n\n```bash\nnpm install reconnect-core\n```\n\n## Kudos\n\nThis has been refactored out of [dominictarr](https://github.com/dominictarr)'s\n[reconnect](https://github.com/dominictarr/reconnect) module.\n\n## License\n\n(MIT)\n\nCopyright (c) 2013 Julian Gruber &lt;julian@juliangruber.com&gt;\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\nof the Software, and to permit persons to whom the Software is furnished to do\nso, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","_attachments":{},"homepage":"https://github.com/juliangruber/reconnect-core","bugs":{"url":"https://github.com/juliangruber/reconnect-core/issues"},"license":"MIT"}