diff --git a/static/js/index.js b/static/js/index.js index c5afa5a..7df1a38 100644 --- a/static/js/index.js +++ b/static/js/index.js @@ -122,7 +122,9 @@ class Game extends GameBasic { let { player } = this; if (player.health <= 0) { + this.ws.close(); this.ws = new WebSocket(origin); + this.ws.addEventListener('message', function (e) { that.recv(e) }); this.player = new Player(false, true); this.entities.push(this.player); } else if (player.isMenu) {