title: Send JSON data from in socket.io from android
body: <p>I have used <a href="https://github.com/Gottox/socket.io-java-client" rel="noreferrer">https://github.com/Gottox/socket.io-java-client</a> for socket programming in android. Now i am receiving JSON response and now i want to send JSON data to this node.js server from my android application please help me out. here is my code</p>
  
  <pre><code>buttonConnect.setOnClickListener(new OnClickListener() {
  
          @Override
          public void onClick(View arg0) {
              // socket = null;
              try {
                  SocketIO socket = new SocketIO(
                          "http://104.131.225.38:8001/");
  
                  socket.connect(new IOCallback() {
  
                      @Override
                      public void onMessage(JSONObject arg0,
                              IOAcknowledge arg1) {
                          try {
                              Log.i("Server saidwsssss:",
                                      "sssss" + arg0.toString(2));
                          } catch (JSONException e) {
                              e.printStackTrace();
                          }
  
                      }
  
                      @Override
                      public void onMessage(String arg0, IOAcknowledge arg1) {
                          Log.i("Server said:", "" + arg0);
  
                      }
  
                      @Override
                      public void onError(SocketIOException arg0) {
                          Log.i("OnError", "" + arg0);
  
                      }
  
                      @Override
                      public void onDisconnect() {
                          Log.i("Connection Terminated",
                                  "Connection Terminated");
  
                      }
  
                      @Override
                      public void onConnect() {
                          Log.i("Connection Established",
                                  "Connection Established");
  
                      }
  
                      @Override
                      public void on(String arg0, IOAcknowledge arg1,
                              Object... arg2) {
                          Log.i("Server Trigger Event:", "" + arg0 + ""
                                  + arg1);
                          if (arg0.equals("nbUsers")) {
                              Log.i("DONE", "DONE" + arg0.toString());
                          }
                          Object[] arguments = arg2;
                          Log.i("Args", "" + arguments[0].toString());
  
                      }
                  });
                  socket.send("hello server");
                  socket.emit("event", "argument1", "argument2", 13.37);
              } catch (Exception e) {
                  e.printStackTrace();
              }
          }
  
      });
  }
  </code></pre>