Python flask_socketio 模块,join_room() 实例源码

我们从Python开源项目中,提取了以下5个代码示例,用于说明如何使用flask_socketio.join_room()

项目:pycommunicate    作者:mincrmatt12    | 项目源码 | 文件源码
def on_connect(self, request_id):
        user = self.app.user_tracker.users[self.app.user_tracker.requests[request_id]]

        if user.socket_connected:
            return

        user.socket_connect()

        flask_socketio.join_room(request_id)
项目:hf_at_py    作者:haifengat    | 项目源码 | 文件源码
def sub_instrument(message):
    print('{0}:join_room'.format(message))
    join_room(message)
项目:kytos    作者:kytos    | 项目源码 | 文件源码
def _enable_websocket_rooms(self):
        socket = self.server
        socket.on_event('join', join_room)
        socket.on_event('leave', leave_room)
项目:git-webhook    作者:NetEaseGame    | 项目源码 | 文件源码
def on_socketio_connect():
    # ????????????? webhook
    user_id = RequestUtil.get_login_user().get('id', '')
    # ????????
    if not user_id:
        return False
    webhooks = AuthUtil.has_auth_webhooks(user_id)
    for webhook in webhooks:
        flask_socketio.join_room(webhook.id)
项目:Joust    作者:bladechapman    | 项目源码 | 文件源码
def on_join(data):
    room_id = data["room_id"]
    if room_id not in active_rooms:
        raise Exception("Room does not exist")
    room = active_rooms[room_id]
    new_player = room.add_new_player(UUID(request.sid))
    active_players[UUID(request.sid)] = new_player
    join_room(room_id)
    player_list = list(map(lambda x: str(x), room.players.keys()))
    socketio.emit("game_update", build_game_update_payload(room), room=str(room_id))