Closed ospfranco closed 6 years ago
Update framework to the latest version (v5.2.0
) and afterward, check this sample again. Everything should work fine :) If you face any issues, please, let me know
just tested it, still crashing on 5.2.1.
Found a workaround, on the socket gateway:
import { SubscribeMessage, WebSocketGateway, WebSocketServer, WsResponse, OnGatewayConnection } from '@nestjs/websockets';
@WebSocketGateway()
export default class SocketGateway implements OnGatewayConnection {
public handleConnection(client: any) {
client.on('error', (err) => {
console.log(err);
});
}
...
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
I'm submitting a...
Current behavior
I'm using a plain websocket connection to the nestjs server, everything works fine except on chrome, when I refresh the page, the server gets a ECONNRESET exception and it completely crashes.
May be related to https://github.com/websockets/ws/issues/1256?
Expected behavior
Gracefully handle socket termination
Minimal reproduction of the problem with instructions
Create a normal websocket client (non socket.io) on chrome Connect to nestjs via websocket (I'm using one of the examples: https://github.com/nestjs/nest/tree/master/sample/02-gateways) Hit refresh Server will crash
What is the motivation / use case for changing the behavior?
Server crashing bug
Environment