I need to make a reliable socket io solution for my android apps for chatting app or similar. When I was tinkering with the system I noticed the socketio java client is getting disconnected every few seconds from the socketio javascript server that I am using for hello world relay server.
I have a device setup to talk to the server but I noticed after 25 to 75 seconds it gets disconnected. I have everything in default settings. I thought socket io server will be good enough as an alternative to firebase but I am not getting reliable connection with this:
socket = IO.socket(uri, opts).also { s ->
s.on(Socket.EVENT_CONNECT) { ...
s.on(Socket.EVENT_DISCONNECT) { ... // after few seconds its state is disconnected.
client version:
implementation("io.socket:socket.io-client:2.1.1")
server version:
"socket.io": "^4.8.1",
server:
const io = new Server(app, { cors: { origin: '*' } });
io.on('connection', socket => {...} // on message... etc. simple hello world server.