title: Grails 2.4 Spring Websocket SockJs Java Android Client
body: <p>Has anyone successfully connected from android to a sockJs server?  I have this code from autobahn on the android client:</p>
  
  <pre><code>            try {
                  mConnection.connect(wsuri, p, new WebSocketHandler() {
  
                      @Override
                      public void onOpen() {
                          Log.d(TAG, "Status: Connected to " + wsuri);
                         mConnection.sendTextMessage("[\"CONNECT\naccept-version:1.1,1.0\nheart-beat:10000,10000\n\n\\u0000\"]");
  
  
  
                      }
  
                      @Override
                      public void onTextMessage(String payload) {
                          Log.d(TAG, "Got echo: " + payload);
                      }
  
                      @Override
                      public void onClose(int code, String reason) {
                          Log.d(TAG, "Connection lost.");
                      }
                  }, options);
  
                  mConnection.sendTextMessage("[\"SUBSCRIBE\nid:sub-0\ndestination:/topic/heartbeat\n\n\u0000\"]");
              } catch (WebSocketException e) {
  
                  Log.d(TAG, e.toString());
              }
  </code></pre>
  
  <p>This code connects to the sockJS server under Spring under Grails.  However, the code loss connection after 5 seconds.  I am not sure what I need to do, to tell the sockeJS server I am listening.</p>