title: Android Websockets onMessage() never being called even on connection
body: <p>I'm using websockets to make a multiplayer game and I need to send multiple types of data across the server but when I connect to the server it's supposed to send back a name and number ("type") and ("data") respectively from the websocket library on connection. I don't need the type but ("data") is vital for the game logic to actually work. </p>
  
  <p>Below is the code I have in my websockets onMessage() function:</p>
  
  <pre><code>@Override
  public void onMessage(String message)
  {                       
      try 
      {
           JSONObject json = new JSONObject(message);
           if(json.has("type") &amp;&amp; json.has("data"))
           {
               Log.d(TAG, json.getString("type"));
               Log.d(TAG, json.getString("data"));
               playerNum = Integer.parseInt(json.getString("data"));
               Log.d(TAG,"Received... Type : " +json.getString("type")+" Data : "+json.getString("data"));
           }
           if(json.has("Player1TurnOver"))
           {
               player1TurnOver = json.getBoolean("Player1TurnOver");
           }
  
           if(json.has("Word"))
           {
              String b = json.getString("Word");
              bWord = new char[b.length()];
              for(int i = 0; i &lt; b.length(); i++)
              {
                   bWord[i] = b.charAt(i);
              }
           wordLength = bWord.length;
          }
       }
       catch(JSONException e)         
       {                  
       }              
  }
  </code></pre>
  
  <p>But this is never called from the server even though the client has a listener as such:</p>
  
  <pre><code>mClient = new WebSocketClient(URI.create("ws://some_ip:8080/wstest"), new WebSocketClient.Listener()){
  </code></pre>
  
  <p>And the listener is initialised within the websocket library class</p>
  
  <pre><code>public interface Listener {
      public void onConnect();
      public void onMessage(String message);
      public void onMessage(byte[] data);
      public void onDisconnect(int code, String reason);
      public void onError(Exception error);
  }
  </code></pre>
  
  <p>I can't seem to figure out why this isn't working properly. As it has worked before...</p>