Open ghost opened 5 years ago
git diff > patch
diff --git a/assets/Script/common/socket.js b/assets/Script/common/socket.js index 0c85401..2e911dd 100644 --- a/assets/Script/common/socket.js +++ b/assets/Script/common/socket.js @@ -37,7 +37,7 @@ Socket.prototype = { on(actionCode, cb) { this.notification.on(actionCode.toString(), (event) => { if (cb) { - cb(event.detail); + cb(event); } }) }, diff --git a/server/index.js b/server/index.js index 228a56e..e69faa9 100644 --- a/server/index.js +++ b/server/index.js @@ -33,4 +33,12 @@ ws.on('connection', function(client){ console.log('clinet closed'); } }); + + client.on('error', () => { + let index = clients.indexOf(client); + if (index !== -1) { + clients.splice(index, 1); + console.log('clinet error closed'); + } + }); }); \ No newline at end of file