예제 #1
0
def join_tournament(message):
    hashid = message['hashid']
    tournament = Tournament.query.filter_by(hashid=hashid).first()
    if not tournament or tournament in current_user.tournaments:
        return
    current_user.tournaments.append(tournament)
    db.session.commit()
    broadcast_online_players(room=hashid)
예제 #2
0
def kick_player(message):
    hashid = message['hashid']
    user_id = message['user_id']
    tournament = Tournament.query.filter_by(hashid=hashid).first()
    user = User.query.filter_by(id=user_id).first()
    if not tournament or not user or tournament not in user.tournaments:
        return
    user.tournaments.remove(tournament)
    db.session.commit()
    broadcast_online_players(room=hashid)
예제 #3
0
def connect_chat():
    # print('Client connected', request.sid)
    broadcast_online_players(broadcast=False)
예제 #4
0
def chat_broadcast_online_players_periodic():
    start = time.process_time()
    broadcast_online_players()
    return str(time.process_time() - start)
예제 #5
0
def connect():
    # print('Client connected', request.sid)
    broadcast_online_players()
예제 #6
0
def init(message):
    room = message['hashid'] if 'hashid' in message else 'public_chat'
    join_room(room)
    broadcast_online_players(broadcast=False, room=room)
예제 #7
0
파일: routes.py 프로젝트: niklasbec/lidarts
def chat_broadcast_online_players_periodic():
    broadcast_online_players()
    return jsonify('success')