Still getting Continual Transport Close every PingInterval | Redis Adapter
Describe the bug A clear and concise description of what the bug is.
I know there is another thread on this https://github.com/socketio/socket.io/issues/3025, but I read through and tried everything and still can't fix this problem, I have loved this package so far but can't seem to get this right!
I have a lot of clients connecting around 7k cc okay but I get a few clients reporting they are having disconnect issues. Looking deeper it shows that on the server they are reconnecting and disconnecting every 25 seconds (see logs below)
My pingInterval is 25000 My pingTimeout is 65000
"@socket.io/redis-adapter": "^7.1.0", "socket.io": "4.4.1",
I'm using Amazon's ALB to 4 targets with redis adapter with a 1-minute timeout and sticky session enabled 100 seconds
Server Code
const { createClient } = require("redis");
const { createAdapter } = require("@socket.io/redis-adapter");
const pubClient = createClient({ url: process.env.REDIS_URI });
const subClient = pubClient.duplicate();
const io = new Server(server, {
// transports: ["websocket"], // https://socket.io/docs/v4/using-multiple-nodes/
allowEIO3: true, // false by default
pingInterval: 25000,
pingTimeout: 65000,
cors: {
origin: "*",
methods: [
"GET",
"POST",
"OPTIONS",
"HEAD",
"PUT",
"PATCH",
"POST",
"DELETE",
],
},
});
Promise.all([pubClient.connect(), subClient.connect()]).then(() => {
io.adapter(createAdapter(pubClient, subClient));
console.log("CONNECTED");
// io.listen(3001); this happens with hapi above
});
Client code (disabled polling and enabled both didn't work)
<script src="/socket.io/socket.io.js"></script>
let socket = io({
query: {
roomId: last_part
},
transports: ['websocket'],
});
Bugged behavior server logs, you can see it's getting a transport close every 25000

Sorry @darrachequesne i am reposting this one https://github.com/socketio/socket.io/issues/4298 to better describe the situation. We can close it and continue discussion here if it helps!
Also have the client HAR and server logs if it helps
@aaronkchsu Could it be possible that some of the client still have a Socket.IO v2 client? That would explain the disconnection on the first ping (the client send a PING packet after 25000 seconds, but the server is supposed to send PING and receive PONG in v3/v4).
See also: https://socket.io/docs/v4/troubleshooting-connection-issues/#the-client-is-not-compatible-with-the-version-of-the-server-1
I have a similar problem with a flask-socketio server app hosted behind an aws alb and the client socket session seems to be consistently disconnecting every 26 seconds.
Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/eventlet/wsgi.py", line 573, in handle_one_response result = self.application(self.environ, start_response) File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 2464, in call return self.wsgi_app(environ, start_response) File "/usr/local/lib/python3.8/site-packages/flask_socketio/init.py", line 45, in call return super(_SocketIOMiddleware, self).call(environ, File "/usr/local/lib/python3.8/site-packages/engineio/middleware.py", line 60, in call return self.engineio_app.handle_request(environ, start_response) File "/usr/local/lib/python3.8/site-packages/socketio/server.py", line 560, in handle_request return self.eio.handle_request(environ, start_response) File "/usr/local/lib/python3.8/site-packages/engineio/server.py", line 374, in handle_request socket = self._get_socket(sid) File "/usr/local/lib/python3.8/site-packages/engineio/server.py", line 565, in _get_socket raise KeyError('Session is disconnected') KeyError: 'Session is disconnected'
Client requests use /socket.io/?EIO=3&transport=polling&t=O9hzOSn&sid=xxxx
Server version of SocketIO is 4.6.0
Closed in favor of https://github.com/socketio/socket.io/issues/4298.