From d6c3dc87e08e72589cb6da04dbb81c1ca91b8831 Mon Sep 17 00:00:00 2001 From: Julien Fontanet Date: Wed, 10 Aug 2022 16:53:38 +0200 Subject: [PATCH] feat(xo-server): avoid warning if client WS has been closed Fixes part of zammad#8826 --- packages/xo-server/src/index.mjs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/xo-server/src/index.mjs b/packages/xo-server/src/index.mjs index bf57cf91f..1b0bd1db9 100644 --- a/packages/xo-server/src/index.mjs +++ b/packages/xo-server/src/index.mjs @@ -612,7 +612,11 @@ const setUpApi = (webServer, xo, config) => { const onSend = error => { if (error) { - log.warn('WebSocket send:', { error }) + // even if the readyState of the socket is checked, it can still happen + // that the message failed to be sent because the connection was closed. + if (error.code !== 'ERR_STREAM_DESTROYED') { + log.warn('WebSocket send:', { error }) + } } } jsonRpc.on('data', data => {