This repository was archived by the owner on Nov 2, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Installation and Configuration
Dmitrii Goriunov edited this page Jan 4, 2018
·
12 revisions
There are two ways to install ClusterWS Client JS library
- Use
npm
to install (only for projects which are using bundle libraries/frameworks likeWebpack
,Gulp
)
npm install --save clusterws-client-js
- Import globally in the html script:
- Navigate to
dist/browser
. - Copy
clusterws.[min].js
to your project. - Import it in html with
<script src="path/to/clusterws.[min].js"></script>
. - Don't forget to take
LICENSE
file :)
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'
})
{
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)'
}
💥 We would really appreciate if you give us stars ⭐ (on all our repositories):
For you to give the stars ⭐ is not hard, but for us, it is a huge motivation to work harder and improve the project. Thank you very much 😄.
1. Home
2. Installation and Configuration
5. Client to Client Communication
Other languages will be added later