socket.io-client-java
socket.io-client-java copied to clipboard
cant set HandShake message
I want to connect v2 socketIo server. in javascript i receive data but i cant receive data with java. because i cant send custom handshake message.. can you help we with this issue ?
Socket.IO server version: v2
Socket.IO java client version: 1.0.1
Client
String handshake = "sample";
try {
IO.Options options = new IO.Options();
Socket socket = IO.socket(new URI(url), options);
socket.connect();
socket.on(Socket.EVENT_CONNECT, args12 -> System.out.println("connected"));
socket.on(Socket.EVENT_CONNECT_ERROR, args13 -> System.out.println("connection error"));
boolean connected = socket.connected();
while (!connected) {
Thread.sleep(1000);
connected = socket.connected();
}
socket.send("handshake", handshake);
socket.emit("handshake", handshake);
socket.on("topic1", args1 -> System.out.println("topic1"));
socket.on("topic2", args1 -> System.out.println("topic2"));
boolean cn = socket.hasListeners("cn");
boolean cs = socket.hasListeners("cs");
while (true) {
connected = socket.connected();
System.out.println("asdasd" + connected);
Thread.sleep(1000);
}
Expected behavior connection success but never get a message. Because i cant send custom handshake message.
Closed due to inactivity, please reopen if needed.