# websocket.js

> WebSocket browser client with reconnect back-off feature.

Latest version **0.1.12** (published 2017-06-16) · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install websocket.js
pnpm add websocket.js
yarn add websocket.js
bun add websocket.js
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.1.12 |
| Published | 2017-06-16 |
| First published | 2015-11-18 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=0.12.0 |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 64 |
| Maintainers | endel |

## Links

- npm: https://www.npmjs.com/package/websocket.js
- Repository: https://github.com/gamestdio/websocket.js
- Homepage: https://github.com/gamestdio/websocket.js#readme
- Issues: https://github.com/gamestdio/websocket.js/issues
- npm.io page: https://npm.io/package/websocket.js

## Dependencies (1)

- [backoff](https://npm.io/package/backoff.md) ^2.4.1

## Recent versions

- 0.1.12 (latest) — 2017-06-16
- 0.1.11 — 2017-06-16
- 0.1.10 — 2017-06-04
- 0.1.9 — 2017-05-26
- 0.1.8 — 2017-05-26
- 0.1.7 — 2016-12-11
- 0.1.6 — 2016-07-03
- 0.1.5 — 2016-02-08
- 0.1.4 — 2015-12-02
- 0.1.3 — 2015-11-19
- 0.1.2 — 2015-11-19
- 0.1.1 — 2015-11-18
- 0.1.0 — 2015-11-18

## README

# @gamestdio/websocket

WebSocket with reconnect back-off feature.

For Node.js support, you should install the `ws` module in your project.

## Installation

`npm i @gamestdio/websocket`

## Usage

`WebSocketClient` behaves exactly in the same way as `WebSocket`.

It accepts an optional third parameter, which is used to configure
[backoff](https://github.com/MathieuTurcotte/node-backoff) feature.

```javascript
// fibonacci backoff strategy
var conn = new WebSocketClient('ws://' + host + ':8080', [], {
  backoff: "fibonacci"
});
```

```javascript
// exponential backoff strategy
var conn = new WebSocketClient('ws://' + host + ':8080', [], {
  backoff: "exponential"
});
```

## Event Listeners

- onclose
- onerror
- onmessage
- onopen
- onreconnect

## License

MIT

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