def on_login(login_info):
try:
game: Game = games[login_info['game']]
player: Player = [player for player in game.players if player.token == login_info['token']][0]
except KeyError:
socketio.emit('error', 'Socket connection must start with sending of token (cookie) and game (id) in JSON format')
return
except IndexError:
socketio.emit('error', 'User does not exist')
return
player.socket_sid = request.sid
socketio.emit('client full', json.dumps(game.retrieve_game(player)), room=player.socket_sid)
评论列表
文章目录