Doesn't work if install all modules, but works if I install only
@nestjs/platform-socket.io: "9.1.6" and @nestjs/websockets: "9.1.6".
What am I doing wrong?
/node_modules/@nestjs/platform-socket.io/node_modules/engine.io/build/server.js:474
const listeners = server.listeners("request").slice(0);
^
TypeError: Cannot read properties of undefined (reading 'slice')
reinstall:
npm i --save @nestjs/websockets @nestjs/platform-socket.io
@WebSocketGateway(80,{ cors: true, transports:['websocket'] })
@Injectable()
export class SocketService implements OnGatewayConnection, OnGatewayDisconnect {
@WebSocketServer()
server: Server;
async handleConnection(socket) {
console.info(`socket Connected ${socket}`);
}
async handleDisconnect(socket) {
console.info(`socket Disconnected ${socket}`);
}
}
Provide the Port number this issue will resolve
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With