socket.io-admin-ui
socket.io-admin-ui copied to clipboard
Redis-adapter -> reject(new Error("timeout reached while waiting for fetchSockets response"))
hello.
I am configuring a socket.io server using pm2 and redis-adapter. I'm using express to bring up the admin ui on the same port as socket.io.
public async connect(http_server: http.Server): Promise<void> {
try {
SocketIO.server = new Server({
cors: {
origin: "*",
credentials: true
},
transports: ['websocket'],
allowUpgrades: true,
});
const pubClient = createClient({
socket: {
host: process.env.REDIS_IP,
port: <number><unknown>process.env.REDIS_PORT,
},
password: process.env.REDIS_PASSWORD
});
const subClient = pubClient.duplicate();
await pubClient.connect();
await subClient.connect();
SocketIO.server.adapter(createAdapter(pubClient, subClient));
SocketIO.server.attach(http_server);
instrument(SocketIO.server, {
auth: {
type: "basic",
username: "...",
password: "^__^",
},
mode: "development",
serverId: `${hostname()}#${process.pid}`,
});
} catch (err) {
process.exit(1);
}
}
run it like this, it works without any problems, but when you connect to http://localhost:3900, the following message occurs after about 3 to 5 seconds.
D:\Project\socket\node_modules\@socket.io\redis-adapter\dist\index.js:615
reject(new Error("timeout reached while waiting for fetchSockets response"));
^
Error: timeout reached while waiting for fetchSockets response
at Timeout._onTimeout (D:\Project\socket\node_modules\@socket.io\redis-adapter\dist\index.js:615:28)
at listOnTimeout (node:internal/timers:564:17)
at processTimers (node:internal/timers:507:7)
https://admin.socket.io <- this url is Same.. the server crashes.
What's the problem? 😢
npm version
"dependencies": {
"@socket.io/admin-ui": "^0.5.1",
"@socket.io/redis-adapter": "^8.0.1",
"express": "^4.18.2",
"redis": "^4.0.4",
"socket.io": "^4.5.4"
},