Manage chat room attributes
Chat room attributes consist of basic attributes (such as room subject, room description, and room announcement) and custom attributes. When basic attributes cannot satisfy the business requirements, users can add custom attributes that are synchronized with all chat room members. Custom attributes can be used to store information such as chat room type, game roles, game status, and host positions. They are stored as key-value maps, and the updates of custom attributes are synchronized with all chat room members.
This page shows how to use the Agora Chat SDK to manage basic and custom attributes of chat rooms in your app.
Understand the tech
The Chat SDK provides the
ChatRoom classes for chat room management, which allows you to implement the following features:
- Set custom attributes of a chat room
- Remove custom attributes of a chat room
- Retrieve or modify basic attributes of a chat room
- Retrieve custom attributes of a chat room
Before proceeding, ensure that you meet the following requirements:
- You have initialized the Chat SDK. For details, see SDK quickstart.
- You understand the call frequency limit of the Chat APIs supported by different pricing plans as described in Limitations.
- You understand the number of chat rooms supported by different pricing plans as described in Pricing Plan Details.
This section introduces how to call the APIs provided by the Chat SDK to implement the features listed above.
Retrieve and modify the chat room attributes
All the chat room members can call
fetchChatRoomFromServer to retrieve the detailed information of the current chat room, including the subject, annoucenments, description, member type, and admin list. The chat room owner and admin can also set and update the chat room information.
Manage chat room announcements
All the chat room members can retrieve the chat room announcements. The chat room owner and admin can set and update the announcements. Once the announcements are updated, all the chat room members receive the
Listen for chat room events
For details, see Chat Room Events.