Get json data on android client listener

A

AC Question

I have code socket io js like this

socket.on('clienstconnected',function(data){

var roomlist={id:'1',roomname:'room1',id:'2',roomname:'room2',id:'3',roomname:'room3'};

socket.emit("clienstconnected",roomlist);

});

and Android code like this

private Emitter.Listener onClienstConnected1 = new Emitter.Listener() {
@override
public void call(Object... args) {
JSONObject data = (JSONObject) args[0];

try{


System.out.println(args[0].toString());
}

catch (Exception e) { Log.e("My App", "Could not parse malformed JSON: \"" + data + "\"");}

}
};

and System.out.println print only one item is : id:'3',roomname:'room3' not all Json item as I want
 

Trending Posts

Forum statistics

Threads
945,890
Messages
6,927,524
Members
3,159,994
Latest member
batni