Socket.io Server does not answer clients

253 views Asked by At

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

1

There are 1 answers

0
Arjun Nurdin On BEST ANSWER

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); } );