From 84278a111c66a466e6b4db62c68ab7ff08eebd87 Mon Sep 17 00:00:00 2001 From: Stefan Rupp Date: Wed, 3 Feb 2021 14:16:05 +0100 Subject: [PATCH] added try clause --- views/player.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/views/player.py b/views/player.py index f0a38de..25a46be 100644 --- a/views/player.py +++ b/views/player.py @@ -70,7 +70,10 @@ async def play_card_js(player_id, card_idx): msg = {"type": "message", "fct": "cardPlayed", "card": s, "card_idx": card_idx, "player": player_id, "num_players": len(the_game.players)} for ws in the_game.websockets: - await ws.send_json(msg) + try: + await ws.send_json(msg) + except Exception: + the_game.websockets.remove(ws) @api.route("/player/{player}/play/{card}")