For version 4.0.0 alpha version check ClusterWS Website (under work)
Lightweight, fast and powerful framework for building scalable WebSocket applications in Node.js. ClusterWS uses cWS a fork of uWebSockets.
:anger: Java Client for ClusterWS - lightweight, fast and powerful framework for building scalable WebSockets applications in Node.js.
License: MIT License
For version 4.0.0 alpha version check ClusterWS Website (under work)
Lightweight, fast and powerful framework for building scalable WebSocket applications in Node.js. ClusterWS uses cWS a fork of uWebSockets.
hi
I use the following code to watch from channel:
ClusterWS socket ;
oncreate (){
initChat();
}
private void initChat() {
socket = new ClusterWS("url");
socket.connect();
socket.setReconnection(true, 2, 10, 20);
socket.setClusterWSListener(new IClusterWSListener() {
@Override
public void onConnected() {
Channel channel = socket.subscribe("match-wall");
channel.watch(new Channel.IChannelListener() {
@Override
public void onDataReceived(String channelName, Object data) {
Gson gson = new Gson();
String json = gson.toJson(data);
try {
JSONObject object = new JSONObject(json);
String action = object.getString("action");
if (action.equals("publish")) {
String username = object.getString("username");
String message = object.getString("message");
String photo = object.getString("photo");
addMessage(username, message, photo);
} else if (action.equals("number-of-users")) {
//Todo
}
} catch (JSONException e) {
e.printStackTrace();
}
}
});
}
@Override
public void onError(Exception exception) {
}
@Override
public void onDisconnected(int code, String reason) {
}
});
}
and this code to send data to server:
private void sendMessage() {
hideKeyboard();
String message = edtChatMsg.getText().toString().trim();
if (TextUtils.isEmpty(message)) {
edtChatMsg.requestFocus();
return;
}
edtChatMsg.setText("");
final JSONObject jsonObject = new JSONObject();
try {
jsonObject.put("username", mUsername);
jsonObject.put("message", message);
} catch (JSONException e) {
e.printStackTrace();
}
Channel channel = socket.getChannelByName("match-wall");
if (channel != null) {
socket.send("match-wall-send-message", jsonObject.toString());
}
}
but socket.send not working.....
I am sincerely thankful.
hi
i added this line to my build.gradle file:
implementation 'com.github.ClusterWS:ClusterWS-Client-Java:1.1.1'
Has the correct version been added?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.