You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Dmitrii Goriunov edited this page Mar 10, 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)
npminstall--saveclusterws-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 :)
Configurations
To connect to the server use ClusterWS instance:
letClusterWS=require('clusterws-client-js')// only if you used npm letsocket=newClusterWS({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)',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)'}}