feat(xo-server): avoid warning if client WS has been closed

Fixes part of zammad#8826
This commit is contained in:
Julien Fontanet 2022-08-10 16:53:38 +02:00
parent 5391a9a5ad
commit d6c3dc87e0

View File

@ -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 => {