summaryrefslogtreecommitdiff
path: root/server.js
diff options
context:
space:
mode:
Diffstat (limited to 'server.js')
-rw-r--r--server.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/server.js b/server.js
index 65f5a7a..3fc6274 100644
--- a/server.js
+++ b/server.js
@@ -2364,6 +2364,11 @@ wss.on('connection', (socket, req) => {
delete game_clients[socket.game_id]
})
+ socket.on('error', (err) => {
+ SLOG(socket, "ERROR" + err)
+ socket.close(1000, err.toString())
+ })
+
socket.on('message', (data) => {
try {
let [ cmd, arg ] = JSON.parse(data)
@@ -2372,7 +2377,7 @@ wss.on('connection', (socket, req) => {
else
handle_observer_message(socket, cmd, arg)
} catch (err) {
- send_message(socket, 'error', err)
+ send_message(socket, 'error', err.toString())
}
})