[core] Add websocket send error handler

This commit is contained in:
devlikepro committed 2025-01-08 09:45:52 +07:00
1 parent 2da901f994
commit 9010388de0
1 file changed
+6 -1
+6 -1
View File
@@ -65,7 +65,12 @@ export class WebsocketGatewayCore
.getSessionEvents(session, events)
.subscribe((data) => {
this.logger.debug(`Sending data to client, event.id: ${data.id}`, data);
socket.send(JSON.stringify(data));
socket.send(JSON.stringify(data), (err) => {
if (!err) {
return;
}
this.logger.error(`Error sending data to client: ${err}`);
});
});
socket.on('close', () => {
this.logger.debug(`Client disconnected - ${socket.id}`);