onRoomUserUpdate method

void onRoomUserUpdate(
  1. String roomID,
  2. ZegoUpdateType updateType,
  3. List<ZegoUser> userList
)

The callback triggered when the number of other users in the room increases or decreases.

Available since: 1.1.0 Description: When other users in the room are online or offline, which causes the user list in the room to change, the developer will be notified through this callback. Use cases: Developers can use this callback to update the user list display in the room in real time. When to trigger:

  1. When the user logs in to the room for the first time, if there are other users in the room, the SDK will trigger a callback notification with updateType being ZegoUpdateTypeAdd, and userList is the other users in the room at this time.
  2. The user is already in the room. If another user logs in to the room through the loginRoom or switchRoom functions, the SDK will trigger a callback notification with updateType being ZegoUpdateTypeAdd.
  3. If other users log out of this room through the logoutRoom or switchRoom functions, the SDK will trigger a callback notification with updateType being ZegoUpdateTypeDelete.
  4. The user is already in the room. If another user is kicked out of the room from the server, the SDK will trigger a callback notification with updateType being ZegoUpdateTypeDelete. Restrictions: If developers need to use ZEGO room users notifications, please ensure that the ZegoRoomConfig sent by each user when logging in to the room has the isUserStatusNotify property set to true, otherwise the callback notification will not be received. Related APIs: loginRoomlogoutRoomswitchRoom
  • roomID Room ID where the user is logged in, a string of up to 128 bytes in length.
  • updateType Update type (add/delete).
  • userList List of users changed in the current room.

Implementation

void onRoomUserUpdate(
  String roomID,
  ZegoUpdateType updateType,
  List<ZegoUser> userList,
) {}