0.2.2 • Published 5 years ago

@cfware/peer-cluster v0.2.2

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

@cfware/peer-cluster

Travis CI Greenkeeper badge NPM Version NPM Downloads MIT

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.

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

Usage

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.

npm install
npm test
0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago