Chat rooms enable real-time messaging among multiple users.
This page shows how to use the Agora Chat SDK to manage the attributes of a chat room in your app.
The Agora Chat SDK provides the Room
, IRoomManager
, and IRoomManagerDelegate
classes for chat room management, which allows you to implement the following features:
Before proceeding, ensure that you meet the following requirements:
This section describes how to call the APIs provided by the Agora Chat SDK to implement chat room features.
All chat room members can call FetchRoomAnnouncement
to retrieve the chat room announcements.
The following code sample shows how to retrieve the chat room announcements:
SDKClient.Instance.RoomManager.FetchRoomAnnouncement(roomId, new ValueCallBack<string>(
onSuccess: (str) => {
},
onError: (code, desc) => {
}
));
Only the chat room owner and admins can call UpdateRoomAnnouncement
to set and update the announcements. The length of the chat room announcements can be a maximum of 512 characters. Once the chat room announcements are updated, all the other chat room members receive the OnAnnouncementChangedFromRoom
callback.
The following code sample shows how to update the chat room announcements:
SDKClient.Instance.RoomManager.UpdateRoomAnnouncement(roomId, announcement, new CallBack(
onSuccess: () => {
},
onError: (code, desc) => {
}
));
The chat room owner and admins can call ChangeRoomName
to set and update the chat room name. The length of a chat room name can be a maximum of 128 characters.
The following code sample shows how to update the chat room name:
SDKClient.Instance.RoomManager.ChangeRoomName(roomId, name, new CallBack(
onSuccess: () => {
},
onError: (code, desc) => {
}
));
The chat room owner and admins can call ChangeRoomDescription
to set and update the chat room description. The length of a chat room description can be a maximum of 512 characters.
The following code sample shows how to update the chat room description:
SDKClient.Instance.RoomManager.ChangeRoomDescription(currentRoomId, description, new CallBack(
onSuccess: () => {
},
onError: (code, desc) => {
}
));
For details, see Chat Room Events.