{"name":"reconnect","version":"1.3.4","homepage":"https://github.com/dominictarr/reconnect","repository":{"type":"git","url":"git://github.com/dominictarr/reconnect.git"},"dependencies":{"backoff":"~1.0.0","request":">=2.12 <3","hyperscript":"1","observable":"1.4","shoe":">=0.0.7 <1","sockjs-stream":"~0.1.2"},"optionalDependencies":{"shoe":">=0.0.7 <1","sockjs-stream":"~0.1.2"},"devDependencies":{"tap":"~0.4.2","macgyver":"1.7.0"},"browserify":"./shoe","scripts":{"test":"tap test/"},"author":{"name":"'Dominic Tarr'","email":"dominic.tarr@gmail.com","url":"http://dominictarr.com"},"license":"MIT","_id":"reconnect@1.3.4","description":"Reconnect a stream (tcp, ws, tls, http) when network goes down.","dist":{"shasum":"19eb10d6742babd5077a61d38cf291c742fd4f80","tarball":"http://registry-npm.ywwl.com/reconnect/download/reconnect-1.3.4.tgz","integrity":"sha512-E/HzWiLvPuMNK51tIh9bTtcqzbgaW8q/AdOT8IifAosfdTso0VFhLMFtbKCN7Iuhtk+S6ofUj4ZtCLPttYhyHA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDByWDExhmtWXTrn6bu1oEm2dJMa9ilEj4SieTq/7EAuwIhANhNv1XGH3sYtdg0a+tlraTdAUpbNbh0mpUOzFqtEF4l"}],"size":7340737,"noattachment":false,"key":"/reconnect/-/reconnect-1.3.4.tgz"},"_from":".","_npmVersion":"1.2.18","_npmUser":{"name":"dominictarr","email":"dominic.tarr@gmail.com"},"maintainers":[{"name":"dominictarr","email":"dominic.tarr@gmail.com"}],"directories":{},"readme":"# reconnect\n\nReconnect a stream (tcp, ws, tls, http) when network goes down.\n\n## Status: LEGACY, use [reconnect-core](https://github.com/juliangruber/reconnect-core)\n\nThis module should now be considered legacy,\nit is recommend to use reconnect-core directly.\nThis module is now only a bundle of wrappers around reconnect-core.\n\nCurrently supports:\n* [tcp](http://nodejs.org/api/net.html)\n* [shoe](https://github.com/substack/shoe) (websocket fallback - on the client-side)\n* [tls](http://nodejs.org/api/tls.html)\n* [sockjs-stream](https://github.com/Raynos/sockjs-stream) (server side websockets)\n* [engine.io-stream](https://github.com/Raynos/engine.io-stream)\n\n## Example\n\nPass a function that will be called every time the stream connects.\nif the connection is broken, reconnect will make a new connection\nand call this function again.\n``` js\nvar reconnect = require('reconnect')\n\nreconnect(function (stream) {\n  //called every time the connection is remade.\n  //only one connection will ever be live at one time.\n}).connect(port)\n```\n\n## WebSockets\n\nwebsockets can be used from both the client and the server, with the same code!\n\n``` js\nvar reconnect = require('reconnect/shoe')\n\nreconnect(function (stream) {\n  //called every time the connection is remade.\n  //only one connection will ever be live at one time.\n}).connect('http://localhost:8080/ws')\n```\n\na [shoe](http://npm.im/shoe) server must be used.\n\n## API\n\n### reconnect (opts, onConnect)\n\nif `opts` is an object it will be passed to [backoff](https://github.com/MathieuTurcotte/node-backoff)\nwhich handles throttling the reconnection attempts. it also accepts a `type` parameter, which may\nbe either `'fibonacci'` or `'exponential'`.\n\n``` js\n//example opts\nvar opts = {\n  randomisationFactor: 0,\n  initialDelay: 10,\n  maxDelay: 300\n}\n```\n\n`opts` is optional. If `opts.immediate` is `true` then we will treat the\nstream as if it does not emit a `\"connect\"` event and fall back to listening\nto the first piece of data. This is useful for non connection streams like\ndatabase cursors or tailing files.\n\npassing `onConnect` to reconnect is short hand for `reconnect(opts).on('connect', onConnect)`\n\n### reconnect.connect (...)\n\nattempt to connect. the arguments will be passed onto the underlying stream type.\n(either you are calling `shoe(uri)` or `net.connect(port)`)\nthese arguments will be used for every subsequent connection attempt.\n\n### emit('connect', stream)\n\nemitted when a new connection is made (that includes after a disconnection!)\n\n### emit('disconnect', stream)\n\nemitted when the stream has disconnected.\n\n### emit ('backoff', attempts, delay)\n\nreemitted from [backoff](https://github.com/MathieuTurcotte/node-backoff)\nwhen reconnect is waiting for the next time to connect.\n\n### emit ('reconnect', attempts, delay)\n\nemitted when attempting a new connection.\n\n### reconnector.reconnect\n\nset to `false` and `reconnect` will not automatically reconnect.\nstarts out true.\n\n## Extending\n\nUse [reconnect-core](https://github.com/juliangruber/reconnect-core) instead.\n\n## Widget\n\nThe reconnect widget has been moved into a separate module\n[reconnect-widget](https://github.com/dominictarr/reconnect-widget)\n\n## License\n\nMIT\n","publish_time":1370523279245,"_cnpm_publish_time":1370523279245,"dist-tags":{"latest":"2.0.2"}}