Search code examples
androidsocket.ioandroidasync-koushjava-websocket

Socket.io android library send method


I am trying to use a socket.io https://github.com/koush/AndroidAsync#androidasync-also-supports-socketiolibrary lib and trying to send a string using webSocket.send("a string"); by creating a new web socket using AsyncHttpClient. and sending string through String callback. but it is not working ?

webSocket.setStringCallback(new WebSocket.StringCallback() {
                    public void onStringAvailable(String s) {
                        System.out.println("I got a string: " + s);
                    }
                });

can any one tell me the right usage of it because ReadMe.txt not updated.


Solution

  • I'm not sure which socket.io android library you're using, but you might want to have a look at socket.io-java-client which is fully android supported