- Notifications
You must be signed in to change notification settings - Fork 3
Home
Shadaï ALI edited this page Sep 15, 2017
·
1 revision
Welcome to the WebSocketAndroidClient wiki!
Wsws = newWs.Builder().from( "ws://server_address");
ws.connect();Basically get raw data
ws.on("path/to/channel", newWs.WsListner() {
@OverridepublicvoidonEvent(StringeventUri, Objectdata) {
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, newWs.WsListner<User>() {
@OverridepublicvoidonEvent(StringeventUri, Useruser) {
if(user != null) Log.e(TAG,user.name);
}
});ws.send("Hello World");or send to specific channel
ws.send("path/to/channel","Hello Channel");