socketio / engine.io-client-java

Engine.IO Client Library for Java
http://socketio.github.io/engine.io-client-java
Other
360 stars 167 forks source link

Ping timeout from server #107

Closed kantorr closed 3 years ago

kantorr commented 3 years ago

My Client is always disconnected from socketIO server after 60 seconds. It seems like my client is not pinging the server but I dont know why that is or where can I setup the pingInterval. Here are my Options for the socket:

 client = new OkHttpClient();
        options = new Options();
        // IO factory options
        options.forceNew = false;
        options.multiplex = true;
        // low-level engine options
        options.transports = new String[]{WebSocket.NAME};
        options.upgrade = false;
        options.rememberUpgrade = false;
        options.query = null;//.setQuery(null)
        options.extraHeaders = null;//.setExtraHeaders(null)
        // Manager options
        options.reconnection = true;//.setReconnection(true)
        options.reconnectionAttempts = 5;//.setReconnectionAttempts(Integer.MAX_VALUE)
        options.reconnectionDelay = 1000;//.setReconnectionDelay(1_000)
        options.reconnectionDelayMax = 5000;//.setReconnectionDelayMax(5_000)
        options.randomizationFactor = 0.5;//.setRandomizationFactor(0.5)
        options.timeout = -1;//30000;

        options.callFactory = client;
        options.webSocketFactory = client;

        options.port = port;
        options.path = path;

I presume I have to match the pingInterval with the SocketIO server but where do i set it up?

Java Client: egine.io-client-2.0.0.jar, socket.io-client-1.0.0.jar

TizioIncognito commented 3 years ago

Hi, I also encountered this problem. I found a bug in class "EventThread". Some times the concurrency of the thread may lock this class and in the class "WebSocket" the boolean "writable" remains false, so the client don't send packets anymore and lost connection. I create a pull request today with the solution. https://github.com/socketio/engine.io-client-java/pull/108

missthom commented 3 years ago

I get same this issue. I use engine.io-client-2.0.0.jar and socket.io-client-1.0.1.jar, My Client is always disconnected from socketIO server after some minutes. I don't know what to do, It shows log:

io.socket.engineio.client.EngineIOException: websocket error in EVENT_ERROR.

Any solutions for this issue???? Help me?

darrachequesne commented 3 years ago

That looks like a version mismatch between the server and the client.

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