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 Mar 10, 2018
·
12 revisions
There are two ways to install ClusterWS Client JS library
- Use
npmto 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].jsto your project. - Import it in html with
<script src="path/to/clusterws.[min].js"></script>. - Don't forget to take
LICENSEfile :)
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)',
autoReconnectOptions: {
attempts: '{number} how many times to try, 0 means unlimit amount. (default 0)',
minInterval: '{number} how long min time wait in ms. (default 1000)',
maxInterval: '{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