-
Notifications
You must be signed in to change notification settings - Fork 4
Home
Shadaï ALI edited this page Sep 15, 2017
·
1 revision
Welcome to the WebSocketAndroidClient wiki!
Ws ws = new Ws.Builder().from( "ws://server_address");
ws.connect();
Basically get raw data
ws.on("path/to/channel", new Ws.WsListner() {
@Override
public void onEvent(String eventUri, Object data) {
if(data != null) //your logic here
}
});
Get parsed object from json response, for example to get User from channel do something like this
ws.on("path/to/channel", User.class, new Ws.WsListner<User>() {
@Override
public void onEvent(String eventUri, User user) {
if(user != null) Log.e(TAG,user.name);
}
});
ws.send("Hello World");
or send to specific channel
ws.send("path/to/channel","Hello Channel");