This repository has been archived by the owner on Nov 2, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Installation and Configuration
Egor Egorov edited this page Mar 20, 2018
·
10 revisions
There are two ways to install ClusterWS Client Java library
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependency>
<groupId>com.github.ClusterWS</groupId>
<artifactId>ClusterWS-Client-Java</artifactId>
<version>1.x.x</version>
</dependency>
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
dependencies {
compile 'com.github.ClusterWS:ClusterWS-Client-Java:1.x.x'
}
To connect to the server use ClusterWS
instance:
/**
url: string - url to the server with ws/wss and port at the end. (must be provided)
*/
String url = "ws://localhost:80";
ClusterWS socket = new ClusterWS(url);
socket.connect();
/**
autoReconnect: boolean - allow to auto-reconnect to the server on lost connection. (default false)
reconnectionIntervalMin: int - how long min time wait. (default 1000) in ms
reconnectionIntervalMax: int - how long max time wait. (default 5000) in ms
reconnectionAttempts: int - how many times to try, 0 means without limit. (default 0)
*/
socket.setReconnection(autoReconnect,reconnectionIntervalMin,reconnectionIntervalMax,reconnectionAttempts);
💥 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 😄.