onRoomUserUpdate property

(void Function(String roomID, ZegoUpdateType updateType, List<ZegoUser> userList)?) onRoomUserUpdate
read / write

房间内其他用户增加或减少的回调通知。

支持版本:1.1.0 及以上。 详情描述:当房间内有其他用户上线或下线时,导致房间内用户列表发生变化,会通过本回调通知开发者。 业务场景:开发者可以通过这个回调来实时更新房间内的用户列表展示。 通知时机:

  1. 用户首次登录房间时,如果房间内有其他用户,SDK 会触发 "updateType" 为 ZegoUpdateTypeAdd 的回调通知,此时 "userList" 为房间内的其他用户。
  2. 用户已在房间内,如果有其他用户通过 loginRoomswitchRoom 函数登录到本房间,SDK 会触发 "updateType" 为 ZegoUpdateTypeAdd 的回调通知。
  3. 用户已在房间内,有其他用户通过 logoutRoomswitchRoom 函数登出本房间,SDK 会触发 "updateType" 为 ZegoUpdateTypeDelete 的回调通知。
  4. 用户已在房间内,如果有其他用户从服务端被踢出本房间,SDK 会触发 "updateType" 为 ZegoUpdateTypeDelete 的回调通知。 使用限制:调用 loginRoom 登录房间时设置 ZegoRoomConfig 参数中的 "isUserStatusNotify" 属性为 "true" 时,才会接收到这个回调通知。如果开发者需要使用在回调通知中处理相关业务,请确保每个登录的用户都将 "isUserStatusNotify" 设置为 "true"。 相关接口:loginRoomlogoutRoomswitchRoom
  • roomID 用户已登录的房间 ID,最大长度为 128 字节的字符串。
  • updateType 更新类型(添加/删除)。
  • userList 当前房间内变更的用户列表。

Implementation

static void Function(
        String roomID, ZegoUpdateType updateType, List<ZegoUser> userList)?
    onRoomUserUpdate;