# reconnect-ws

> Reconnect a websocket stream when it goes down.

Latest version **0.1.0** (published 2015-03-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install reconnect-ws
pnpm add reconnect-ws
yarn add reconnect-ws
bun add reconnect-ws
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2015-03-22 |
| First published | 2014-03-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 8 |
| Author | Rong Shen |
| Maintainers | jacobbubu |
| Keywords | reconnect, websocket, ws, stream |

## Links

- npm: https://www.npmjs.com/package/reconnect-ws
- Repository: https://github.com/jacobbubu/reconnect-ws
- Issues: https://github.com/jacobbubu/reconnect-ws/issues
- npm.io page: https://npm.io/package/reconnect-ws

## Dependencies (2)

- [reconnect-core](https://npm.io/package/reconnect-core.md) ^1.0.0
- [websocket-stream](https://npm.io/package/websocket-stream.md) ^1.4.0

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 0.1.0 (latest) — 2015-03-22
- 0.0.0 — 2014-03-18

## README

# reconnect-ws

Reconnect a [websocket stream](https://github.com/maxogden/websocket-stream) when it goes down.

## Usage

```js
var reconnect = require('reconnect-ws');

// this is the server
var WebSocketServer = require('ws').Server;
var wss = new WebSocketServer({port: 8080});
wss.on('connection', function(ws) {
  ws.send('Hello, client!');
});

// this is the client
reconnect(function (stream) {
  stream.on('data', console.log);
  // => yup, I'm up!
}).connect(8080)
```

See [example.js](./example.js) for detailed usage.

For the events you can listen to, see
[reconnect-core](https://github.com/juliangruber/reconnect-core#usage).

## Installation

With [npm](https://npmjs.org) do:

```
npm install reconnect-ws
```

## License

(MIT)

Copyright (c) 2013 Rong Shen &lt;rongshen@gmail.com&gt;

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

---
_Source: https://npm.io/package/reconnect-ws · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
