You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here's a code snippet of my current socket implementation which does throws the error
const{ Server }=require("socket.io");const{ createAdapter }=require("@socket.io/redis-adapter");const{ Emitter }=require("@socket.io/redis-emitter");const{ createClient }=require("redis");constredis=require('../../configs/redis');constenv=process.env.NODE_ENV||'local';consthost=redis[env].host||'127.0.0.1';constport=redis[env].port||6379;letio=null;letemitter=null;functionstartServer(server){constpubClient=createClient({url: `rediss://${host}:${port}`,// rediss:// is the secure version of redis://});constsubClient=pubClient.duplicate();consttasks=[pubClient.connect(),subClient.connect()];Promise.all(tasks).then(()=>{emitter=newEmitter(pubClient);constserverOptions={adapter: createAdapter(pubClient,subClient,{key: adapterKey,requestsTimeout: 10000}),connectionStateRecovery: {maxDisconnectionDuration: 2*60*1000,// the backup duration of the sessions and the packetsskipMiddlewares: true,// whether to skip middlewares upon successful recovery},cors: {origin: ['http://localhost:8080','http://localhost:3000','http://localhost',]}};io=newServer(server,serverOptions);io.on('connection',(socket)=>{console.log(`WebSocket connection established: socket.id ${socket.id} for ${ioKey}`);socket.on('error',function(err){console.error('Socket error',err);});});io.on('socketMessage',(data)=>{console.log(`${ioKey} received socketMessage`);// Logs all clusters that received the message});io.on('error',(err)=>{console.error('WebSocket server error',err);});io.on('close',()=>{console.error('WebSocket server closed');});io.engine.on("connection_error",(err)=>{console.error('WebSocket connection error',err);// See https://socket.io/docs/v4/troubleshooting-connection-issues});}).catch((err)=>{console.error('FATAL: Could not start Socket.io server with redis adapter',err);});}
Thanks for the help
The text was updated successfully, but these errors were encountered:
When using this package with node-redis, I get the following error
The only related issue I can find, is this one which describes switching to io-redis over node-redis when using elasticache for cluster mode. #484
This issue in node-redis says support was added: redis/node-redis#2065 but they don't really give any documention on how to use it.
Does this package support node-redis with Elasticache in AWS? I'm running Redis OSS cluster serverless. Thanks for the help
Here's a code snippet of my current socket implementation which does throws the error
Thanks for the help
The text was updated successfully, but these errors were encountered: