From 5a3fe4468ac15507f76fe2009e6ffe82963b7f4d Mon Sep 17 00:00:00 2001 From: tigerbot Date: Wed, 26 Apr 2017 17:37:52 -0600 Subject: [PATCH] suppressing log when trying to send on closing websocket --- wsclient.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/wsclient.js b/wsclient.js index c2506d2..6dcafc1 100644 --- a/wsclient.js +++ b/wsclient.js @@ -239,7 +239,11 @@ function run(copts) { try { wstunneler.send(msg, {binary: true}); } catch (err) { - console.warn('[sendMessage] error sending websocket message', err); + // There is a chance that this occurred after the websocket was told to close + // and before it finished, in which case we don't need to log the error. + if (wstunneler.readyState !== wstunneler.CLOSING) { + console.warn('[sendMessage] error sending websocket message', err); + } } } }