diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/sockets.js | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/sockets.js b/lib/sockets.js index 874cafcc..ee453ce7 100644 --- a/lib/sockets.js +++ b/lib/sockets.js @@ -56,8 +56,12 @@ wss.on("connection", function (ws) { }); ws.on("close", function () { - const username = names[id]; - if (sockets[username] && sockets[username][id]) delete sockets[username][id]; - l.info("socket closed", username); + try { + const username = names[id]; + if (sockets[username] && sockets[username][id]) delete sockets[username][id]; + l.info("socket closed", username, id); + } catch(e) { + l.error("problem closing socket", e.message); + } }); }); |
