socketio / socket.io-client-java

Full-featured Socket.IO Client Library for Java, which is compatible with Socket.IO v1.0 and later.
https://socketio.github.io/socket.io-client-java/installation.html
Other
5.31k stars 969 forks source link

Getting EVENT_CONNECT_ERROR from Android to Node #751

Closed dasavc closed 1 year ago

dasavc commented 1 year ago

Describe the bug I cannot get the Java client to connect, server does not even register the connection attempt. Node server works as it's serving other clients. Any ideas how I could at least get error description?

To Reproduce

        val options = IO.Options()
        options.forceNew = true
        options.reconnection = true
        options.reconnectionDelay = 2000
        options.reconnectionDelayMax = 5000
        try {
            mSocket = IO.socket("https://xx.xxx.xx.xx")
            mSocket!!.on(Socket.EVENT_CONNECT, onConnect)
            mSocket!!.on(Socket.EVENT_CONNECT_ERROR, onConnectError)
            mSocket!!.on(Socket.EVENT_DISCONNECT, onDisconnect)
            if (!mSocket!!.connected()) {
                mSocket!!.connect()
            }
        } catch (e: URISyntaxException) {
            throw RuntimeException(e)
        }

        private val onConnectError = Emitter.Listener { Log.d("SOCKETIO", "onConnectError") }

On the server I'm trying to capture the attempt:

       io.on("connect_error", (err) => {
           console.log(`connect_error due to ${err.message}`);
       });

Server Socket.IO server version: 4.5.1

Client Socket.IO java client version: 2.1.0

dasavc commented 1 year ago

The problem was in network configuration and is not related to socketio.