title: Android app websocket request very slow
body: <p>I try to test websocket through an Android application with Xamarin and a nodeJs server. I have a speed problem with the socket.emit request : it is very slow (about 20 seconds, it's the delay between the button click and the moment when I see "console.log(data)" on the nodejs console). However it is quick with the socket.on to receive data. I don't know why.
  My code is very basic I know but it is only to see how the websocket works.</p>
  
  <p>Android app</p>
  
  <pre><code>using System;
  using Android.App;
  using Android.Content;
  using Android.Runtime;
  using Android.Views;
  using Android.Widget;
  using Android.OS;
  using Quobject.SocketIoClientDotNet.Client;
  
  namespace TestWebSocket
  {
      [Activity(Label = "TestWebSocket", MainLauncher = true, Icon = "@drawable/icon")]
      public class MainActivity : Activity
      {
          private Socket socket;
          private EditText textEnvoi;
          private EditText textReponse;
          private Button button;
          private string dataSend;
  
          protected override void OnCreate(Bundle bundle)
          {   
              base.OnCreate(bundle);
  
              // Set our view from the "main" layout resource
              SetContentView(Resource.Layout.Main);           
  
              // Get our button from the layout resource,
              // and attach an event to it
              button = FindViewById&lt;Button&gt;(Resource.Id.MyButton);
              textEnvoi = FindViewById&lt;EditText&gt;(Resource.Id.sendText);
              textReponse = FindViewById&lt;EditText&gt;(Resource.Id.reponseText);            
  
              button.Click += delegate {
                  socket = IO.Socket("http://192.168.1.xx:8080/");
                  dataSend = textEnvoi.Text;
  
                  socket.Emit("txt", dataSend);
  
                  socket.On("dataReceive", data =&gt;
                      {
                          //textReponse.Text = data.ToString();
                          Console.WriteLine("Texte : {0}", data.ToString());
                      }
                  );
              };
          }
      }
  }
  </code></pre>
  
  <p>NodeJs code</p>
  
  <pre><code>var http = require('http');
  
  // Chargement du fichier index.html affiché au client
  var server = http.createServer(function(req, res) {
          res.writeHead(200);
          res.end("content");
  });
  
  // Chargement de socket.io
  var io = require('socket.io').listen(server);
  
  // Quand un client se connecte, on le note dans la console
  io.sockets.on('connection', function (socket) {
  
      socket.on('txt', function(data) {
          console.log(data);
         socket.broadcast.emit("dataReceive", data)
     })
  
  
  });
  
  server.listen(8080);
  </code></pre>