RedisIoAdapter没有调用签名
在实现 RedisIoAdapter 如何在https://docs.nestjs.com/websockets/adapter 中进行描述后,我试图将 socket.io-redis 作为调度程序
import { IoAdapter } from '@nestjs/platform-socket.io';
import * as redisIoAdapter from 'socket.io-redis';
export class RedisIoAdapter extends IoAdapter {
createIOServer(port: number, options?: any): any {
const server = super.createIOServer(port, options);
const redisAdapter = redisIoAdapter({ host: 'localhost', port: 6379 });
server.adapter(redisAdapter);
return server;
}
}
出现错误redisIoAdapter
此表达式不可调用。
"socket.io-redis": "^6.0.1"
"@nestjs/platform-socket.io": "^7.6.4",
"@nestjs/websockets": "^7.6.4",
回答
这就是错误的原因。只需将Redis套接字包降级5.0
到即可。
参考:Nextjs-Socket-Io-Redis-6.0.1