added try clause

This commit is contained in:
Stefan Rupp 2021-02-03 14:16:05 +01:00
parent f23319b7b8
commit 84278a111c

View File

@ -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:
try:
await ws.send_json(msg)
except Exception:
the_game.websockets.remove(ws)
@api.route("/player/{player}/play/{card}")