title: Android socket io client node js cant get values
body: <p>I am developing an android application implementing socket io client by using <a href="https://github.com/Gottox/socket.io-java-client" rel="nofollow">https://github.com/Gottox/socket.io-java-client</a>.     </p>
  
  <p>My Nodejs server    </p>
  
  <pre><code>var app = require('http').createServer(),    
      io = require('socket.io').listen(app),
      http = require('http'),
      mysql = require('mysql'),
      connectionsArray = [],
      connection = mysql.createConnection({               
          host: 'localhost',
          user: 'root',
          password: '',
          database: 'login',
          port: 3306
      });
  
  app.listen(3000);
  
  io.sockets.on('connection', function (socket) { 
      socket.on('register_usernames', function (data) {
          io.sockets.socket(socket.id).emit('register_usernames' , {username:"one"});
          io.sockets.socket.(socket.id).emit('register_usernames_one', {username:"two"});
          getBookingHistory(data);
      });
  
      connectionsArray.push(socket);
  });
  </code></pre>
  
  <p>Android Client    </p>
  
  <pre><code>package com.nuappz.socketdemo;
  
  import io.socket.IOAcknowledge;
  import io.socket.IOCallback;
  import io.socket.SocketIO;
  import io.socket.SocketIOException;
  
  import java.net.MalformedURLException;
  
  import org.json.JSONObject;
  
  import android.app.Activity;
  import android.os.Bundle;
  import android.util.Log;
  
  public class Search extends Activity implements IOCallback{
      SocketIO socket;
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          // TODO Auto-generated method stub
          super.onCreate(savedInstanceState);
          try {
              // Try making the socket connection
              socket = new SocketIO("http://nuappzdev.weteksi.com:3000/");
              socket.connect(this);
          } catch (MalformedURLException e1) {
              // TODO Auto-generated catch block
              e1.printStackTrace();
          }
  
          socket.emit("register_usernames", "123");   
      }
      @Override
      public void onDisconnect() {
          // TODO Auto-generated method stub  
      }
      @Override
      public void onConnect() {
          // TODO Auto-generated method stub  
      }
      @Override
      public void onMessage(String data, IOAcknowledge ack) {
          // TODO Auto-generated method stub  
      }
      @Override
      public void onMessage(JSONObject json, IOAcknowledge ack) {
          // TODO Auto-generated method stub  
      }
      @Override
      public void on(String event, IOAcknowledge ack, Object... args) {
          // TODO Auto-generated method stub
          if(event.equals("register_usernames")) {
              Log.d("message response", args.toString());
          } else if (event.equals("register_usernames_one")) {
              Log.d("message reply", args.toString());
          }   
      }
      @Override
      public void onError(SocketIOException socketIOException) {
          // TODO Auto-generated method stub  
      }
  }    
  </code></pre>
  
  <p>In on Method when the event recevied it displays the args. But it shows the following error</p>
  
  <p>Logcat    </p>
  
  <pre><code>06-09 18:25:52.321:I/io.socket(1890):&gt;5:::{"args":       ["123"],"name":"register_usernames"}
  06-09 18:25:52.322: I/io.socket(1890): &lt; 1::
  06-09 18:25:52.408: I/io.socket(1890): &lt; 5:::{"name":"message_response","args":  [{"username":"one"}]}
  06-09 18:25:52.409: D/message response(1890): [Ljava.lang.Object;@4177d208
  06-09 18:25:52.409: I/io.socket(1890): &lt; 5:::{"name":"message_reply","args": [{"username":"two"}]}
  06-09 18:25:52.409: D/message reply(1890): [Ljava.lang.Object;@41739f30
  06-09 18:25:52.471: D/dalvikvm(1890): threadid=16: interp stack at 0x5d914000    
  </code></pre>
  
  <p>1.How can i send data on emit and how to get it from the client side.<br>
  2.How can i send an array or Json and parse it. </p>