socket.io-client-java
socket.io-client-java copied to clipboard
I want to check whether the user is online or not .
I want to check a particular user active or not. For example when i enter a user name. I want to check whether it is active or not. I got the android code is
ChatApplication app = (ChatApplication) getApplication();
mSocket = app.getSocket();
JSONObject user = new JSONObject();
try {
user.put("userId", "abc");
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
mSocket.emit("login",user);
And server part code is
socket.on('new user',function(data, callback){ if (nicknames.indexOf(data)!=-1){ callback(false); } else{ callback(true); socket.nickname = data; nicknames.push(socket.nickname); updateNicknames(); } });
But it is not working. emit("login",user); is not showing anything. How to solve this problem? Please help me.
is resolved your problem?
ya, I solve my problem. Thank you.