# @cfware/peer-cluster

> Websocket all-to-all connectivity cluster

Latest version **0.2.2** (published 2019-05-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install @cfware/peer-cluster
pnpm add @cfware/peer-cluster
yarn add @cfware/peer-cluster
bun add @cfware/peer-cluster
```

## 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.2.2 |
| Published | 2019-05-01 |
| First published | 2019-03-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=12 |
| Dependencies | 1 |
| Unpacked size | 15.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Corey Farrell |
| Maintainers | coreyfarrell |

## Links

- npm: https://www.npmjs.com/package/@cfware/peer-cluster
- Repository: https://github.com/cfware/peer-cluster
- Homepage: https://github.com/cfware/peer-cluster#readme
- Issues: https://github.com/cfware/peer-cluster/issues
- npm.io page: https://npm.io/package/@cfware/peer-cluster

## Dependencies (1)

- [ws](https://npm.io/package/ws.md) ^7.0.0

## Recent versions

- 0.2.2 (latest) — 2019-05-01
- 0.2.1 — 2019-04-27
- 0.2.0 — 2019-04-25
- 0.1.2 — 2019-04-05
- 0.1.1 — 2019-03-31
- 0.1.0 — 2019-03-30

## README

# @cfware/peer-cluster

[![Travis CI][travis-image]][travis-url]
[![Greenkeeper badge][gk-image]](https://greenkeeper.io/)
[![NPM Version][npm-image]][npm-url]
[![NPM Downloads][downloads-image]][downloads-url]
[![MIT][license-image]](LICENSE)

Websocket all-to-all connectivity cluster.

### Install @cfware/peer-cluster

This module requires node.js 12 or above with support for ESM modules.  This
has only been tested/used with `esm`.

```sh
npm i --save esm @cfware/peer-cluster
```

## Usage

```js
import {createServer} from 'http';

import pEvent from 'p-event';
import {PeerCluster} from '@cfware/peer-cluster';

(async () => {
	const httpd = createServer();
	httpd.listen(0);
	await pEvent(httpd, 'listening');

	const peerCluster = new PeerCluster({
		peerId: 'server1',
		origin: `ws://localhost:${httpd.address().port}/`,
		respond404: true
	});

	httpd.on('upgrade', (req, sock, head) => {
		cluster.tryUpgrade(req, sock, head);
	});
})();
```

## Running tests

Tests are provided by xo and ava.

```sh
npm install
npm test
```

[npm-image]: https://img.shields.io/npm/v/@cfware/peer-cluster.svg
[npm-url]: https://npmjs.org/package/@cfware/peer-cluster
[travis-image]: https://travis-ci.org/cfware/peer-cluster.svg?branch=master
[travis-url]: https://travis-ci.org/cfware/peer-cluster
[gk-image]: https://badges.greenkeeper.io/cfware/peer-cluster.svg
[downloads-image]: https://img.shields.io/npm/dm/@cfware/peer-cluster.svg
[downloads-url]: https://npmjs.org/package/@cfware/peer-cluster
[license-image]: https://img.shields.io/npm/l/@cfware/peer-cluster.svg

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