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

Cannot interop with server implemented in 'io.socket:socket.io-server:4.0.1' #737

Open chenzx opened 1 year ago

chenzx commented 1 year ago

Describe the bug I expect latest socket.io-client-java 2.1.0 can interop with 'io.socket:socket.io-server:4.0.1', but can't

Android 10 emulator, client use config:

IO.Options opt = IO.Options.builder()
                    // IO factory options
                    .setForceNew(true)
                    .setMultiplex(true)
                    // low-level engine options
                    .setTransports(new String[] { Polling.NAME, WebSocket.NAME })
//                    .setTransports(new String[] { WebSocket.NAME })
                    .setUpgrade(true)
                    .setRememberUpgrade(false)
                    .setPath("/owt/")
                    .setQuery(null)
                    .setExtraHeaders(null)
                    // Manager options
                    .setReconnection(true)
                    .setReconnectionAttempts(Integer.MAX_VALUE)
                    .setReconnectionDelay(1_000)
                    .setReconnectionDelayMax(5_000)
                    .setRandomizationFactor(0.5)
                    .setTimeout(6_000)
                    // Socket options
                    .setExtraHeaders(singletonMap("accept-encoding", singletonList("identity")))
                    .setAuth(null)
                    .build();
            if (socketIOClient != null) {
                Log.d(TAG, "stop reconnecting the former url");
                socketIOClient.disconnect();
            }
            socketIOClient = IO.socket(url, opt);

server code is based on https://github.com/trinopoty/socket.io-server-java/blob/master/socket.io-server-test/

juanobligado commented 7 months ago

Having the same issue, seems that the client is tied to server 3.x version. Would like to work on a patch for this