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 Dec 31, 2017
·
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)',reconnectionIntervalMin: '{number} how long min time waut. (default 1000) in ms',reconnectionIntervalMax: '{number} how long max time wait. (default 5000) in ms',reconnectionAttempts: '{number} how many times to try, 0 means without limit. (default 0)',}