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.32k stars 972 forks source link

io.socket.engineio.client.EngineIOException: server error #687

Closed ersinware closed 2 years ago

ersinware commented 2 years ago

Although the connection is made in Javascript, I am not able to do it in Kotlin. It proves that there is no problem with server.

This is Javascript code which works fine:

    const socket = io('https://...', {
            path: '/ws',
            reconnection: false,
            query: {
                'auth-token': '...'
            }
        }
    );

    socket.on('connect', () => {
        console.log("connect")
    });`

This is Kotlin code which throws io.socket.engineio.client.

    ...
    implementation 'io.socket:socket.io-client:2.0.1
    ...

    val uri = URI.create(host)
    val options = IO.Options.builder().setPath("/ws").setQuery("auth-token=$accessToken").build()
    val socket = IO.socket(uri, options)

    socket.on("connect") {
        println("connect")
    }

    socket.on("connect_error") {
        println(it[0])
        println("connect_error")
    }

    socket.connect()

The output is: io.socket.engineio.client.EngineIOException: server error connect_error io.socket.engineio.client.EngineIOException: server error connect_error io.socket.engineio.client.EngineIOException: server error connect_error io.socket.engineio.client.EngineIOException: server error connect_error

dzungvu commented 2 years ago

I have the same issue today. I don't know if this is a bug or not. But I try to downgrade socket io to version 1.0.1 then the error has gone.

darrachequesne commented 2 years ago

For future readers:

Please check the compatibility table here: https://socketio.github.io/socket.io-client-java/installation.html

Please reopen if needed.

irshadir7 commented 1 year ago

its works only when downgraded. how can I use onAny function with latest server because facing same error