首页 > 解决方案 > Socket.io-redis 作为适配器添加到 Socket.io 实例时会出错

问题描述

我正在尝试使用 Socket.io 和 Socket.Io-redis。我已经启动并运行了我的 Redis 服务器。我在启动 Socket.Io 服务器时遇到的错误是:ReplyError: ERR unknown command 'pubsub' 我不知道为什么我会收到这个错误。

我使用的 Redis 版本是 2.4.5

io.adapter(redisIO({host: 'localhost', port: 6379}));
io.of('/').adapter.clients((err, clients) => {
            if(err){
                console.log('error!!')
                throw err;
            }

标签: node.jsrediswindows-10node-clustersocket.io-redis

解决方案


我通过安装最新版本的 Redis 来修复它!:)


推荐阅读