1

I'm using Socket.IO client library from this repository: io.socket:socket.io-client:1.0.0 and server library from this com.corundumstudio.socketio:netty-socketio:1.7.12.

I'm emitting a simple data object between client and server. Server works in binary and fires event listener only when binary data comes with this event:

socketServer.addEventListener("event", ResponseData.class, new DataListener<ResponseData>() {
        @Override
        public void onData(SocketIOClient client, ResponseData data, AckRequest ackSender) throws Exception {
            // data is a binary
        }
    });

However, client works in json and not binary. It gives received data in json, but I can convert it into object. Problem is that when I emit object, it converts it into json, so server doesn't call the event listener on it.

socket.on("event", new Emitter.Listener() {
            @Override
            public void call(Object... args)
            {
                // args[0] is a JSONObject not binary!
                clientSocket.emit("event", new ResponseData("var")); // gets converted into JSONObject

            }
        });

How can I make the client library work in binary and not in json? I see it has decoder, encoder options inIO.Options` class that may help.

Gintas_
  • 4,940
  • 12
  • 44
  • 87

0 Answers0