0

On the server, I changed the transport to websocket, and used socket.io-client.js as the client, and it worked.

socket.io-client.js

{"GET":{"scheme":"ws","host":"113.14.15.178:3000","filename":"/socket.io/","query":{"EIO":"4","transport":"websocket"},"remote":{"Address":"113.14.15.178:3000"}}}

I'm having a problem, when the version uses socket.io-client.java on my Android application. The server doesn't respond to requests when I use socket.io-client.java

socket.io-client.java

{"GET":{"scheme":"ws","host":"113.14.15.178:3000","filename":"/socket.io/","query":{"EIO":"3","transport":"websocket"},"remote":{"Address":"113.14.15.178:3000"}}}

whether, the problem is with Engine.IO which is used in socket.IO-client. is there a solution for that

Arjun Nurdin
  • 13
  • 1
  • 10
  • I would guess you have an incompatible version of `socket.io-client.java` based on the differing EIO parameter (which is Engine IO version). You probably need a newer version of the socket.io Java client library that matches your server's protocol version. – jfriend00 Dec 07 '20 at 09:30
  • have a reference to change version 4 on java client, or downgrade server to version 3 – Arjun Nurdin Dec 07 '20 at 10:20

1 Answers1

0

I've solved my own problem. if you are having the same problem. you can try the following:

  1. add Websocket client module in your project

    implementation 'blabla:ws:version'

  2. make the same query that comes out of the server header

     ws.header({"filename":"/socket.io/"}).query({"EIO":"4","transport":"websocket"}); 

  3. check outgoing messages and incoming messages, from socket.io and websocket clients, when using webscocket-client.js.

example:

  • input:40
  • out:20
  • input:30
  • out:20
  • input:30
  • out:20
  1. then do the same thing to make the condition true.
    ws.open( (40) ? ws.send(20) : ws.reconection(); );
    ws.massage( if(30){ ws.send(20); } );
Arjun Nurdin
  • 13
  • 1
  • 10