Chat SDK for Unity and Windows v1.2.1
Public Member Functions | List of all members
AgoraChat.RoomManager Class Reference
Inheritance diagram for AgoraChat.RoomManager:

Public Member Functions

void AddRoomAdmin (string roomId, string memberId, CallBack callback=null)
 
void BlockRoomMembers (string roomId, List< string > members, CallBack callback=null)
 
void ChangeRoomOwner (string roomId, string newOwner, CallBack callback=null)
 
void ChangeRoomDescription (string roomId, string newDescription, CallBack callback=null)
 
void ChangeRoomName (string roomId, string newName, CallBack callback=null)
 
void CreateRoom (string name, string descriptions=null, string welcomeMsg=null, int maxUserCount=300, List< string > members=null, ValueCallBack< Room > callback=null)
 
void DestroyRoom (string roomId, CallBack callback=null)
 
void FetchPublicRoomsFromServer (int pageNum=1, int pageSize=200, ValueCallBack< PageResult< Room > > callback=null)
 
void FetchRoomAnnouncement (string roomId, ValueCallBack< string > callback=null)
 
void FetchRoomBlockList (string roomId, int pageNum=1, int pageSize=200, ValueCallBack< List< string > > callback=null)
 
void FetchRoomInfoFromServer (string roomId, ValueCallBack< Room > callback=null)
 
void FetchRoomMembers (string roomId, string cursor="", int pageSize=200, ValueCallBack< CursorResult< string > > callback=null)
 
void FetchRoomMuteList (string roomId, int pageSize=200, int pageNum=1, ValueCallBack< Dictionary< string, long > > callback=null)
 
void JoinRoom (string roomId, ValueCallBack< Room > callback=null)
 
void LeaveRoom (string roomId, CallBack callback=null)
 
void MuteRoomMembers (string roomId, List< string > members, long muteMilliseconds=-1, CallBack callback=null)
 
void RemoveRoomAdmin (string roomId, string adminId, CallBack callback=null)
 
void DeleteRoomMembers (string roomId, List< string > members, CallBack callback=null)
 
void UnBlockRoomMembers (string roomId, List< string > members, CallBack callback=null)
 
void UnMuteRoomMembers (string roomId, List< string > members, CallBack callback=null)
 
void UpdateRoomAnnouncement (string roomId, string announcement, CallBack callback=null)
 
void MuteAllRoomMembers (string roomId, ValueCallBack< Room > callback=null)
 
void UnMuteAllRoomMembers (string roomId, ValueCallBack< Room > callback=null)
 
void AddAllowListMembers (string roomId, List< string > members, CallBack callback=null)
 
void RemoveAllowListMembers (string roomId, List< string > members, CallBack callback=null)
 
void FetchAllowListFromServer (string roomId, ValueCallBack< List< string > > callback=null)
 
void CheckIfInRoomAllowList (string roomId, ValueCallBack< bool > callback=null)
 
Room GetChatRoom (string roomId)
 
void AddAttributes (string roomId, Dictionary< string, string > kv, bool deleteWhenExit=true, bool forced=false, ValueCallBack< Dictionary< string, int > > callback=null)
 
void FetchAttributes (string roomId, List< string > keys=null, ValueCallBack< Dictionary< string, string > > callback=null)
 
void RemoveAttributes (string roomId, List< string > keys, bool forced=false, ValueCallBack< Dictionary< string, int > > callback=null)
 
void AddRoomManagerDelegate (IRoomManagerDelegate roomManagerDelegate)
 
void RemoveRoomManagerDelegate (IRoomManagerDelegate roomManagerDelegate)
 

Detailed Description

The abstract class for the chat manager.

Member Function Documentation

◆ AddRoomAdmin()

void AgoraChat.RoomManager.AddRoomAdmin ( string  roomId,
string  memberId,
CallBack  callback = null 
)

Adds a chat room admin.

Only the chat room owner can call this method.

This is an asynchronous method.

Parameters
chatRoomIdThe chat room ID.
memberIdThe user ID of the chat room admin to be added.
callbackThe operation result callback. See CallBack.

◆ BlockRoomMembers()

void AgoraChat.RoomManager.BlockRoomMembers ( string  roomId,
List< string >  members,
CallBack  callback = null 
)

Adds members to the block list of the chat room.

Only the chat room owner or admin can call this method.

Note

This is an asynchronous method.

Parameters
roomIdThe chat room ID.
membersThe list of members to be added to block list of the chat room.
callbackThe operation result callback. See CallBack.

◆ ChangeRoomOwner()

void AgoraChat.RoomManager.ChangeRoomOwner ( string  roomId,
string  newOwner,
CallBack  callback = null 
)

Transfers the chat room ownership.

Only the chat room owner can call this method.

This is an asynchronous method.

Parameters
chatRoomIdThe chat room ID.
newOwnerThe user ID of the new chat room owner.
callbackThe operation result callback. See CallBack.

◆ ChangeRoomDescription()

void AgoraChat.RoomManager.ChangeRoomDescription ( string  roomId,
string  newDescription,
CallBack  callback = null 
)

Modifies the chat room description.

Only the chat room owner can call this method.

This is an asynchronous method.

Parameters
roomIdThe chat room ID.
newDescriptionThe new description of the chat room.
callbackThe operation result callback. See CallBack.

◆ ChangeRoomName()

void AgoraChat.RoomManager.ChangeRoomName ( string  roomId,
string  newName,
CallBack  callback = null 
)

Changes the chat room name.

Only the chat room owner can call this method.

This is an asynchronous method.

Parameters
roomIdThe chat room ID.
newNameThe new name of the chat room.
callbackThe operation result callback. See CallBack.

◆ CreateRoom()

void AgoraChat.RoomManager.CreateRoom ( string  name,
string  descriptions = null,
string  welcomeMsg = null,
int  maxUserCount = 300,
List< string >  members = null,
ValueCallBack< Room callback = null 
)

Creates a chat room.

This is an asynchronous method.

Parameters
nameThe chat room name.
descriptionThe chat room description.
welcomeMsgA welcome message inviting members to join the chat room.
maxUserCountThe maximum number of members allowed to join the chat room.
membersThe list of members invited to join the chat room.
callbackThe operation result callback. See CallBack.

◆ DestroyRoom()

void AgoraChat.RoomManager.DestroyRoom ( string  roomId,
CallBack  callback = null 
)

Destroys a chat room.

Only the chat room owner can call this method.

This is an asynchronous method.

Parameters
roomIdThe chat room ID.
callbackThe operation result callback. See CallBack.

◆ FetchPublicRoomsFromServer()

void AgoraChat.RoomManager.FetchPublicRoomsFromServer ( int  pageNum = 1,
int  pageSize = 200,
ValueCallBack< PageResult< Room > >  callback = null 
)

Gets chat room data from the server with pagination.

For a large but unknown quantity of data, you can get data with pagination by specifying pageNum and pageSize.

This is an asynchronous method.

Parameters
pageNumThe page number, starting from 1.
pageSizeThe number of records that you expect to get on each page. For the last page, the number of returned records is less than the parameter value.
callbackThe operation result callback. See CallBack.

◆ FetchRoomAnnouncement()

void AgoraChat.RoomManager.FetchRoomAnnouncement ( string  roomId,
ValueCallBack< string >  callback = null 
)

Gets the chat room announcement from the server.

This is an asynchronous method.

Parameters
roomIdThe chat room ID.
callbackThe operation result callback. See CallBack.

◆ FetchRoomBlockList()

void AgoraChat.RoomManager.FetchRoomBlockList ( string  roomId,
int  pageNum = 1,
int  pageSize = 200,
ValueCallBack< List< string > >  callback = null 
)

Gets the block list of the chat room with pagination.

For a large but unknown quantity of data, you can get data with pagination by specifying pageSize and cursor.

Only the chat room owner or admin can call this method.

This is an asynchronous method.

Parameters
roomIdThe chat room ID.
pageNumThe page number, starting from 1.
pageSizeThe number of users on the block list that you expect to get on each page. For the last page, the number of returned users is less than the parameter value.
callbackThe operation result callback. See CallBack.

◆ FetchRoomInfoFromServer()

void AgoraChat.RoomManager.FetchRoomInfoFromServer ( string  roomId,
ValueCallBack< Room callback = null 
)

Gets details of a chat room from the server, excluding the member list by default.

This is an asynchronous method.

Parameters
roomIdThe chat room ID.
callbackThe operation callback. If success, the chat room instance is returned; otherwise, an error is returned. See ValueCallBack.

◆ FetchRoomMembers()

void AgoraChat.RoomManager.FetchRoomMembers ( string  roomId,
string  cursor = "",
int  pageSize = 200,
ValueCallBack< CursorResult< string > >  callback = null 
)

Gets the chat room member list with pagination. For a large but unknown quantity of data, you can get data with pagination by specifying pageSize and cursor.

This is an asynchronous method.

Parameters
roomIdThe chat room ID.
cursorThe cursor position from which to start to get data. At the first method call, if you set cursor as null, the SDK gets the data in the reverse chronological order of when users joined the chat room. Amid the returned data (CursorResult), cursor is a field saved locally and the updated cursor can be passed as the position from which to start to get data for the next query.
pageSizeThe number of members that you expect to get on each page. For the last page, the number of returned members is less than the parameter value.
callbackThe operation callback. If success, the chat room member list is returned; otherwise, an error is returned. See ValueCallBack.

◆ FetchRoomMuteList()

void AgoraChat.RoomManager.FetchRoomMuteList ( string  roomId,
int  pageSize = 200,
int  pageNum = 1,
ValueCallBack< Dictionary< string, long > >  callback = null 
)

Gets the list of members who are muted in the chat room.

For a large but unknown quantity of data, you can get data with pagination by specifying pageSize and cursor.

Only the chat room owner or admin can call this method.

This is an asynchronous method.

Parameters
roomIdThe chat room ID.
pageNumThe page number, starting from 1.
pageSizeThe number of muted members that you expect to get on each page. For the last page, the actual number of returned members is less than the parameter value.
callbackThe operation callback. If success, the chat room mute list is returned; otherwise, an error is returned. See ValueCallBack.

◆ JoinRoom()

void AgoraChat.RoomManager.JoinRoom ( string  roomId,
ValueCallBack< Room callback = null 
)

Joins the chat room.

To exit the chat room, you can call LeaveRoom(String, CallBack).

This is an asynchronous method.

Parameters
roomIdThe ID of the chat room to join.
callbackThe operation callback. If success, the chat room instance is returned; otherwise, an error is returned. See ValueCallBack.

◆ LeaveRoom()

void AgoraChat.RoomManager.LeaveRoom ( string  roomId,
CallBack  callback = null 
)

Leaves a chat room.

After joining a chat room via JoinRoom(String, ValueCallBack), the member can call LeaveRoom to leave the chat room.

This is an asynchronous method.

Parameters
roomIdThe ID of the chat room to leave.
callbackThe operation callback. See CallBack.

◆ MuteRoomMembers()

void AgoraChat.RoomManager.MuteRoomMembers ( string  roomId,
List< string >  members,
long  muteMilliseconds = -1,
CallBack  callback = null 
)

Mutes members in a chat room.

Only the chat room owner or admin can call this method.

This is an asynchronous method.

Parameters
roomIdThe chat room ID.
membersThe list of members to be muted.
muteMillisecondsMuted time duration in millisecond, -1 stand for eternity.
callbackThe operation callback. See CallBack.

◆ RemoveRoomAdmin()

void AgoraChat.RoomManager.RemoveRoomAdmin ( string  roomId,
string  adminId,
CallBack  callback = null 
)

Removes the administrative privileges of a chat room admin.

Only the chat room owner can call this method.

This is an asynchronous method.

Parameters
roomIdThe chat room ID.
adminIdThe user ID of the admin whose administrative privileges are to be removed.
callbackThe operation callback. See CallBack.

◆ DeleteRoomMembers()

void AgoraChat.RoomManager.DeleteRoomMembers ( string  roomId,
List< string >  members,
CallBack  callback = null 
)

Removes members from a chat room.

Only the chat room owner or admin can call this method.

This is an asynchronous method.

Parameters
roomIdThe chat room ID.
membersThe list of members to be removed from the chat room.
callbackThe operation callback. See CallBack.

◆ UnBlockRoomMembers()

void AgoraChat.RoomManager.UnBlockRoomMembers ( string  roomId,
List< string >  members,
CallBack  callback = null 
)

Removes members from the block list of the chat room.

Only the chat room owner or admin can call this method.

This is an asynchronous method.

Parameters
roomIdThe chat room ID.
membersThe list of members to be removed from the block list of the chat room.
callbackThe operation callback. See CallBack.

◆ UnMuteRoomMembers()

void AgoraChat.RoomManager.UnMuteRoomMembers ( string  roomId,
List< string >  members,
CallBack  callback = null 
)

Unmutes members in a chat room.

Only the chat room owner or admin can call this method.

This is an asynchronous method.

Parameters
roomIdThe chat room ID.
membersThe list of members to be unmuted.
callbackThe operation callback. See CallBack.

◆ UpdateRoomAnnouncement()

void AgoraChat.RoomManager.UpdateRoomAnnouncement ( string  roomId,
string  announcement,
CallBack  callback = null 
)

Updates the chat room announcement.

Only the chat room owner or admin can call this method.

This is an asynchronous method.

Parameters
roomIdThe chat room ID.
announcementThe announcement content.
callbackThe operation callback. See CallBack.

◆ MuteAllRoomMembers()

void AgoraChat.RoomManager.MuteAllRoomMembers ( string  roomId,
ValueCallBack< Room callback = null 
)

Mutes all members. Only the chat room owner or admin can call this method. This method does not work for the chat room owner, admin, and members added to the allow list.

This is an asynchronous method.

Parameters
roomIdThe chat room ID.
callbackThe completion callback.

◆ UnMuteAllRoomMembers()

void AgoraChat.RoomManager.UnMuteAllRoomMembers ( string  roomId,
ValueCallBack< Room callback = null 
)

Unmutes all members.

Only the chat room owner or admin can call this method.

This is an asynchronous method.

Parameters
roomIdThe chat room ID.
callbackThe completion callback.

◆ AddAllowListMembers()

void AgoraChat.RoomManager.AddAllowListMembers ( string  roomId,
List< string >  members,
CallBack  callback = null 
)

Adds members to the allow list.

Only the chat room owner or admin can call this method.

A call to the MuteAllMembers method by the chat room owner or admin does not affect members on the allow list.

This is an asynchronous method.

Parameters
roomIdThe chat room ID.
membersThe list of members to be added to the allow list.
callbackThe completion callback.

◆ RemoveAllowListMembers()

void AgoraChat.RoomManager.RemoveAllowListMembers ( string  roomId,
List< string >  members,
CallBack  callback = null 
)

Removes members from the block list.

Only the chat room owner or admin can call this method.

When members are removed from the block list, a call to the method MuteAllMembers(String, EMValueCallBack) will also mute them.

This is an asynchronous method.

Parameters
roomIdThe chat room ID.
membersThe list of members to be removed from the block list.
callbackThe completion callback.

◆ FetchAllowListFromServer()

void AgoraChat.RoomManager.FetchAllowListFromServer ( string  roomId,
ValueCallBack< List< string > >  callback = null 
)

Gets the chat room allow list from the server.

Only the chat room owner or admin can call this method.

This is an asynchronous method.

Parameters
chatRoomIdThe chat room ID.
callBackThe completion callback. If this call succeeds, the SDK calls ValueCallBack#OnSuccessValue(Object); If this call fails, the SDK calls ValueCallBack#onError(int, String).

◆ CheckIfInRoomAllowList()

void AgoraChat.RoomManager.CheckIfInRoomAllowList ( string  roomId,
ValueCallBack< bool >  callback = null 
)

Checks whether the current member is on the chat room block list.

This is an asynchronous method.

Parameters
roomIdThe chat room ID.
callBackThe completion callback. If this call succeeds, the SDK calls ValueCallBack#OnSuccessValue(Object) to show whether the member is on the block list; if this call fails, the SDK calls ValueCallBack#onError(int, String).

◆ GetChatRoom()

Room AgoraChat.RoomManager.GetChatRoom ( string  roomId)

Gets the chat room in the memory.

Parameters
roomIdThe chat room ID.
Returns
The chat room instance. The SDK creates a new chat room instance based on the chat room ID (roomId) and returns it if the chat room is not found in the memory.

◆ AddAttributes()

void AgoraChat.RoomManager.AddAttributes ( string  roomId,
Dictionary< string, string >  kv,
bool  deleteWhenExit = true,
bool  forced = false,
ValueCallBack< Dictionary< string, int > >  callback = null 
)

Sets custom chat room attributes. All members in the chat room owner can call this method.

This is an asynchronous method.

Parameters
roomIdThe chat room ID.
kvThe chat room attributes to add. The attributes are in key-value format. In a key-value pair, the key is the attribute name that can contain 128 characters at most; the value is the attribute value that cannot exceed 4096 characters. A chat room can have a maximum of 100 custom attributes and the total length of custom chat room attributes cannot exceed 10 GB for each app. Attribute keys support the following character sets:
  • 26 lowercase English letters (a-z)
  • 26 uppercase English letters (A-Z)
  • 10 numbers (0-9)
  • "_", "-", "." @deleteWhenExit Whether to delete the chat room attributes set by the member when he or she exits the chat room.
    • (Default)true: Yes.

◆ FetchAttributes()

void AgoraChat.RoomManager.FetchAttributes ( string  roomId,
List< string >  keys = null,
ValueCallBack< Dictionary< string, string > >  callback = null 
)

Gets the list of custom chat room attributes based on the attribute key list.

All members in the chat room owner can call this method.

This is an asynchronous method.

Parameters
roomIdThe chat room ID.
keysThe key list of attributes to get. If you set it as null or leave it empty, this method retrieves all custom attributes.
callbackThe completion callback. If this call succeeds, the SDK calls ValueCallBack#OnSuccessValue(Dictionary<string, string>); if this call fails, the SDK calls ValueCallBack#onError(int, String).

◆ RemoveAttributes()

void AgoraChat.RoomManager.RemoveAttributes ( string  roomId,
List< string >  keys,
bool  forced = false,
ValueCallBack< Dictionary< string, int > >  callback = null 
)

Removes custom chat room attributes by chat room ID and attribute key list.

All members in the chat room can call this method.

This is an asynchronous method.

Parameters
roomIdThe chat room ID.
keysThe keys of custom chat room attributes to remove. @forced Whether to remove attributes with same key set by others.
callbackThe completion callback. If this call succeeds, the SDK calls CallBackResult#OnSuccessResult(Dictionary<string, int>); if this call fails, the SDK calls CallBackResult#onError(int, String).

◆ AddRoomManagerDelegate()

void AgoraChat.RoomManager.AddRoomManagerDelegate ( IRoomManagerDelegate  roomManagerDelegate)

Adds a chat room listener.

Parameters
roomManagerDelegateThe chat room listener to add. It is inherited from IRoomManagerDelegate.

◆ RemoveRoomManagerDelegate()

void AgoraChat.RoomManager.RemoveRoomManagerDelegate ( IRoomManagerDelegate  roomManagerDelegate)

Removes a chat room listener.

Parameters
roomManagerDelegateThe chat room listener to remove. It is inherited from IRoomManagerDelegate.