Skip to content
This repository was archived by the owner on Nov 2, 2020. It is now read-only.

Installation and Configuration

Dmitrii Goriunov edited this page Jan 4, 2018 · 12 revisions

Installation

There are two ways to install ClusterWS Client JS library

  • Use npm to install (only for projects which are using bundle libraries/frameworks like Webpack, Gulp)
npm install --save clusterws-client-js
  • Import globally in the html script:
  1. Navigate to dist/browser.
  2. Copy clusterws.[min].js to your project.
  3. Import it in html with <script src="path/to/clusterws.[min].js"></script>.
  4. Don't forget to take LICENSE file :)

Configurations

To connect to the server use ClusterWS instance:

let ClusterWS = require('clusterws-client-js') // only if you used npm 

let socket = new ClusterWS({
    url: 'ws://localhost:80'
})

Available configurations

{
    url: '{string} url to the server with ws/wss and port at the end. (must be provided)',
    autoReconnect: '{boolean} allow to auto-reconnect to the server on lost connection. (default false)',
    reconnectionAttempts: '{number} how many times to try, 0 means unlimit amount. (default 0)',
    reconnectionIntervalMin: '{number} how long min time wait in ms. (default 1000)', 
    reconnectionIntervalMax: '{number} how long max time wait in ms. (default 5000)'
}

English:

1. Home

2. Installation and Configuration

3. Handle Socket

4. Pub/Sub System

5. Client to Client Communication

Other languages will be added later

Clone this wiki locally