onRoomUserUpdate method
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:
- 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
beingZegoUpdateTypeAdd
, anduserList
is the other users in the room at this time. - The user is already in the room. If another user logs in to the room through the
loginRoom
orswitchRoom
functions, the SDK will trigger a callback notification withupdateType
beingZegoUpdateTypeAdd
. - If other users log out of this room through the
logoutRoom
orswitchRoom
functions, the SDK will trigger a callback notification withupdateType
beingZegoUpdateTypeDelete
. - 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
beingZegoUpdateTypeDelete
. Restrictions: If developers need to use ZEGO room users notifications, please ensure that theZegoRoomConfig
sent by each user when logging in to the room has theisUserStatusNotify
property set to true, otherwise the callback notification will not be received. Related APIs:loginRoom
、logoutRoom
、switchRoom
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,
) {}