def close(message):
    session["receive_count"] = session.get("receive_count", 0) + 1
    emit(
        "my response",
        {"data": "Room " + message["room"] + " is closing.", "count": session["receive_count"]},
        room=message["room"],
    )
    close_room(message["room"])
示例#2
0
文件: app.py 项目: fordham-css/br00t
def close(message):
    session['receive_count'] = session.get('receive_count', 0) + 1
    emit('my response', {
        'data': 'Room ' + message['room'] + ' is closing.',
        'count': session['receive_count']
    },
         room=message['room'])
    close_room(message['room'])
示例#3
0
def leave_socket_room(room_id):
    """Leave a room on Parse and socketIO"""
    username = current_user.username
    room = Room.getRoom(objectId=room_id)

    # Doesn't seem to work after we leave the room, so do it now:
    emit('response', {'data': username + ' has left the room.'}, room=room_id)

    room.remove_user(username)
    room.save()
    leave_room(room.objectId)
    session['room'] = ''
    if room.is_empty:
        close_room(room.objectId)
    emit('update_room', room.to_dict(), room=room_id, broadcast=True)
示例#4
0
def close(message):
    session['receive_count'] = session.get('receive_count', 0) + 1
    emit('my response', {'data': 'Room ' + message['room'] + ' is closing.',
                         'count': session['receive_count']},
         room=message['room'])
    close_room(message['room'])