title: listen to an io socket event with an Android client
body: <p>first of all excuse my english, because i am not good in english. I'm looking for a way to retrieve information in android send from a nodeJS server with socket io. I have the impression that it is a problem of version. my code compiles very well, I do not manage to retrieve the information contained in a JS object.
  here is the server code</p>
  
  <pre><code> var app = require('express')();
   var http = require('http').Server(app);
   var io = require('socket.io')(http);
    var data ={"msg": "hello  i am the server"};
  
  io.on('connection',function(socket){
  console.log('one user connected '+socket.id);
  socket.on('message',function(obj){
  
      console.log(obj.text);
        socket.emit('take', data);
    })
  socket.on('disconnect',function(){
      console.log('one user disconnected '+socket.id);
   })
  
   })
  
   http.listen(3000,function(){
    console.log('server listening on port 3000');
    })
  </code></pre>
  
  <p>the information I'm looking for is  'data'</p>
  
  <p>here is the java code I use, I prefer to put the whole code in case the problem is elsewhere</p>
  
  <pre><code>    public class MainActivity extends AppCompatActivity {
  private Socket socket;
  public String ReceiveMsg ="message par defaut ";
  {
      try {
          socket = IO.socket("http://192.168.43.168:3000");
          socket.connect();
      } catch (URISyntaxException e) {
      }
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      EditText editText = (EditText) findViewById(R.id.editText);
      TextView textView = (TextView) findViewById(R.id.textView);
      Button but = (Button) findViewById(R.id.button);
      socket.connect();
      String msg = takemsg(editText);
      sendMsg(msg);
      socket.on("take", handleIncomingMessages);
      textView.setText(getAz(ReceiveMsg));
      }
  
     public  String takemsg(EditText editText){
   String msg = "message par defaut ";
  msg = editText.getText().toString();
  return msg;
  }
   public void sendMsg(String msg ){
    JSONObject obj = new JSONObject();
    try{
      obj.put("text", msg);
      socket.emit("message", obj);
  }catch (JSONException e){
  }
   }
  
  private Emitter.Listener handleIncomingMessages = new Emitter.Listener(){
      @Override
      public void call(final Object... args){
          runOnUiThread(new Runnable() {
              @Override
              public void run() {
                  JSONObject data = (JSONObject) args[0];
                  try {
                      ReceiveMsg = data.getString("msg");
                  } catch (JSONException e) {
  
                  }
              }
          });
      }
  };
  }
  </code></pre>