Android - Socket.io - no logs, no connection
<p>I'm trying to use socket.io/engine.io (<a href="https://github.com/socketio/socket.io-client-java" rel="nofollow noreferrer">https://github.com/socketio/socket.io-client-java</a>) to connect to websocket server. I wrote any point as the guthub page described, but I have no connection, even no log that something happens or not.. EVENT_CONNECTED is not fired. I don't know what is the problem- maybe socket.IO is not working with android 5.1UP? The websocket server is tested with JS and is working fine.
There is my very simple code, it will be great if you know socket.io and could take a look:</p>

<p>Ws implementation:</p>

<pre><code>public class MyWsImplInIo {
    private Socket socket;
    public void start(){
        try{
            socket = IO.socket("http://192.168.1.8:8080/tmed-webserver/call");
            socket.on(Socket.EVENT_CONNECT, new Emitter.Listener() {
                @Override
                public void call(Object... args) {
                    socket.emit("foo", "hi");
                    socket.disconnect();
                }
            }).on("event", new Emitter.Listener() {
                @Override
                public void call(Object... args) {
                }
            }).on(Socket.EVENT_DISCONNECT, new Emitter.Listener() {
                @Override
                public void call(Object... args) {
                }
            });
            socket.connect();
        } catch(Exception e){
            Log.d("WEBSOCKET", "SOME ERROR");
            e.printStackTrace();
        }
    }
}
</code></pre>

<p>And a main activity:</p>

<pre><code>public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        MyWsImplInIo a = new MyWsImplInIo();
        a.start();
    }
}
</code></pre>