Options
All
  • Public
  • Public/Protected
  • All
Menu

react-native-agora-chat

Agora Chat is a highly reliable global communication platform where your users can chat one-to-one, in groups or in chat rooms. Users communicate with text messages, share images, audios, videos, files, emojis, and locations. Agora Chat supplies typing indicators out-of-the-box.

  • The ChatClient class is the entry of the chat SDK. It provides methods to allow you to log in to and log out of the chat app and manage the connection between the SDK and the chat server.
  • The ChatManager class provides methods to allow you to send and receive messages, manage conversations , and download attachments.
  • The ChatMessage class defines message attributes .
  • The ChatConversation class provides methods for conversation management.
  • The ChatContactManager class provides methods for chat contact management such as adding, retrieving, modifying, and deleting contacts.
  • The ChatGroupManager class provides methods for group management, like group creation and destruction and member management.
  • The ChatRoomManager class provides methods for chat room management, like joining and leaving the chat room and retrieving the chat room list, and manages member privileges.
  • The ChatPresenceManager class provides methods for you to set message push configuration options.
  • The ChatPushManager class provides methods to allow you to manage offline push services.
  • The ChatUserInfoManager class provides methods for user attribute management, including getting and updating user attributes.

ChatClient

Method Description
getInstance The chat client class, which is the entry of the chat SDK. It defines how to log in to and log out of the chat app and how to manage the connection between the SDK and the chat server.
getEventEmitter The chat client class, which is the entry of the chat SDK. It defines how to log in to and log out of the chat app and how to manage the connection between the SDK and the chat server.
setNativeListener The chat client class, which is the entry of the chat SDK. It defines how to log in to and log out of the chat app and how to manage the connection between the SDK and the chat server.
version The chat client class, which is the entry of the chat SDK. It defines how to log in to and log out of the chat app and how to manage the connection between the SDK and the chat server.
options Gets the SDK configurations.
currentUserName Gets the current logged-in user ID.
init Initializes the SDK.
isConnected Checks whether the SDK is connected to the chat server.
getCurrentUsername Gets the current logged-in user ID from the server.
isLoginBefore Checks whether the current user is logged in to the app.
getAccessToken Gets the token for login.
createAccount Creates a new user (open registration).
login Logs in to the chat server with a password or an Easemob token.
loginWithAgoraToken Logs in to the chat server with the user ID and an Agora token.
renewAgoraToken Renews the Agora token.
logout Logs out of the chat app.
changeAppKey Updates the App Key, which is the unique identifier used to access the chat service.
compressLogs Compresses the debug log file into a gzip archive.
getLoggedInDevicesFromServer Gets the list of online devices to which you have logged in with a specified account.
kickDevice Logs out from a specified account on a device.
kickAllDevices Logs out from a specified account on all devices.
updatePushConfig Update push configurations.
addConnectionListener Adds the connection status listener.
removeConnectionListener Removes the connection status listener.
removeAllConnectionListener Removes all the connection status listeners for the chat server.
addMultiDeviceListener Adds the multi-device listener.
removeMultiDeviceListener Removes the specified multi-device listener.
removeAllMultiDeviceListener Removes all the multi-device listeners.
addCustomListener Adds a custom listener to receive data that the iOS or Android devices send to the React Native layer.
removeCustomListener Removes a custom listener to stop receiving data that the iOS or Android devices send to the React Native layer.
removeAllCustomListener Removes all the custom listeners.
chatManager Gets the chat manager class.
groupManager Gets the chat group manager class.
contactManager Gets the contact manager class.
pushManager Gets the push manager class.
userManager Gets the user information manager class.
roomManager Gets the chat room manager class.
presenceManager Gets the presence manager class.
Event Description
onConnected Occurs when the SDK connects to the chat server successfully.
onDisconnected Occurs when the SDK disconnects from the chat server.
onTokenWillExpire Occurs when the Agora token is about to expire.
onTokenDidExpire Occurs when the Agora token has expired.
onAppActiveNumberReachLimit The number of daily active users (DAU) or monthly active users (MAU) for the app has reached the upper limit.
Event Description
onContactEvent Occurs when a contact event occurs.
onGroupEvent Occurs when a group event occurs.
onThreadEvent Occurs when a thread event occurs.
Event Description
onDataReceived The custom event listener.

ChatManager

Method Description
setNativeListener The chat manager class, responsible for sending and receiving messages, managing conversations (including loading and deleting conversations), and downloading attachments.
addMessageListener Adds a message listener.
removeMessageListener Removes the message listener.
removeAllMessageListener Removes all message listeners.
sendMessage Sends a message.
resendMessage Resends a message.
sendMessageReadAck Sends the read receipt to the server.
sendGroupMessageReadAck Sends the group message receipt to the server.
sendConversationReadAck Sends the conversation read receipt to the server.
recallMessage Recalls the sent message.
getMessage Gets a message from the local database by message ID.
markAllConversationsAsRead Marks all conversations as read.
getUnreadCount Gets the count of the unread messages.
insertMessage Inserts a message to the conversation in the local database.
updateMessage Updates the local message.
importMessages Imports messages to the local database.
downloadAttachment Downloads the message attachment.
downloadThumbnail Downloads the message thumbnail.
fetchHistoryMessages Uses the pagination to get messages in the specified conversation from the server.
fetchHistoryMessagesByOptions retrieve the history message for the specified session from the server.
searchMsgFromDB Retrieves messages with keywords in a conversation from the local database.
fetchGroupAcks Uses the pagination to get read receipts for group messages from the server.
removeConversationFromServer Deletes the specified conversation and its historical messages from the server.
getConversation Gets the conversation by conversation ID and conversation type.
getAllConversations Gets all conversations from the local database.
fetchAllConversations Gets the conversation list from the server.
deleteConversation Deletes a conversation and its local messages from the local database.
getLatestMessage Gets the latest message from the conversation.
getLatestReceivedMessage Gets the latest received message from the conversation.
getConversationUnreadCount Gets the unread message count of the conversation.
markMessageAsRead Marks a message as read.
markAllMessagesAsRead Marks all messages as read.
updateConversationMessage Updates a message in the local database.
deleteMessage Deletes a message from the local database.
deleteAllMessages Deletes all messages in the conversation from both the memory and local database.
deleteMessagesBeforeTimestamp Deletes local messages with timestamp that is before the specified one.
getMessagesWithMsgType Retrieves messages of a certain type in the conversation from the local database.
getMessages Retrieves messages of a specified quantity in a conversation from the local database.
getMessagesWithKeyword Gets messages that the specified user sends in a conversation in a certain period.
getMessageWithTimestamp Retrieves messages that are sent and received in a certain period in a conversation in the local database.
translateMessage Translates a text message.
fetchSupportedLanguages Gets all languages supported by the translation service.
setConversationExtension Sets the extension information of the conversation.
addReaction Adds a Reaction.
removeReaction Deletes a Reaction.
fetchReactionList Gets the list of Reactions.
fetchReactionDetail Gets the Reaction details.
reportMessage Reports an inappropriate message.
getReactionList Gets the list of Reactions from a message.
groupAckCount Gets the number of members that have read the group message.
createChatThread Creates a message thread.
joinChatThread Joins a message thread.
leaveChatThread Leaves a message thread.
destroyChatThread Destroys the message thread.
updateChatThreadName Changes the name of the message thread.
removeMemberWithChatThread Removes a member from the message thread.
fetchMembersWithChatThreadFromServer Uses the pagination to get a list of members in the message thread.
fetchJoinedChatThreadFromServer Uses the pagination to get the list of message threads that the current user has joined.
fetchJoinedChatThreadWithParentFromServer Uses the pagination to get the list of message threads that the current user has joined in the specified group.
fetchChatThreadWithParentFromServer Uses the pagination to get the list of message threads in the specified group.
fetchLastMessageWithChatThread Gets the last reply in the specified message threads from the server.
fetchChatThreadFromServer Gets the details of the message thread from the server.
getMessageThread Gets the details of the message thread from the memory.
getThreadConversation Gets the thread conversation by conversation ID.
fetchConversationsFromServerWithPage Gets conversations from the server with pagination.
removeMessagesFromServerWithMsgIds Deletes messages from the conversation (from both local storage and server).
removeMessagesFromServerWithTimestamp Deletes messages from the conversation (from both local storage and server).
Event Description
onMessagesReceived Occurs when a message is received.
onCmdMessagesReceived Occurs when a command message is received.
onMessagesRead Occurs when a read receipt is received for a message.
onGroupMessageRead Occurs when a read receipt is received for a group message.
onMessagesDelivered Occurs when a delivery receipt is received.
onMessagesRecalled Occurs when a received message is recalled.
onConversationsUpdate Occurs when the conversation is updated.
onConversationRead Occurs when a conversation read receipt is received.
onMessageReactionDidChange Occurs when a message reaction changes.
onChatMessageThreadCreated Occurs when a message thread is created.
onChatMessageThreadUpdated Occurs when a message thread is updated.
onChatMessageThreadDestroyed Occurs when a message thread is destroyed.
onChatMessageThreadUserRemoved Occurs when the current user is removed from the message thread by the admin.

ChatContactManager

Method Description
setNativeListener The contact manager class, which manages chat contacts such as adding, retrieving, modifying, and deleting contacts.
addContactListener Adds a contact listener.
removeContactListener Removes the contact listener.
removeAllContactListener Removes all contact listeners.
addContact Adds a new contact.
deleteContact Deletes a contact and all the related conversations.
getAllContactsFromServer Gets the contact list from the server.
getAllContactsFromDB Gets the contact list from the local database.
addUserToBlockList Adds a contact to the block list.
removeUserFromBlockList Removes the contact from the block list.
getBlockListFromServer Gets the block list from the server.
getBlockListFromDB Gets the block list from the local database.
acceptInvitation Accepts a friend invitation。
declineInvitation Declines a friend invitation.
getSelfIdsOnOtherPlatform Gets the unique IDs of the current user on the other devices. The ID is in the format of {user_ID} + "/" + {resource_ID}.
Event Description
onContactAdded Occurs when a friend request from the current user is accepted by the peer user.
onContactDeleted Occurs when a friend request from the current user is declined by the peer user.
onContactInvited Occurs when a friend request is received by the current user.
onFriendRequestAccepted Occurs when a friend request is accepted by the current user.
onFriendRequestDeclined Occurs when a friend request is declined by the current user.

ChatGroupManager

Method Description
setNativeListener The group manager class, which defines how to manage groups, like group creation and destruction and member management.
getGroupWithId Gets the group instance from the memory by group ID.
getJoinedGroups Gets the list of groups that the current user has joined.
fetchJoinedGroupsFromServer Gets the list of groups that the current user has joined.
fetchPublicGroupsFromServer Gets public groups from the server with pagination.
createGroup Creates a group instance.
fetchGroupInfoFromServer Gets the group information from the server.
fetchMemberListFromServer Uses the pagination to get the member list of the group from the server.
fetchBlockListFromServer Uses the pagination to get the group block list from the server.
fetchMuteListFromServer Uses the pagination to get the mute list of the group from the server.
fetchAllowListFromServer Uses the pagination to get the allow list of the group from the server.
isMemberInAllowListFromServer Gets whether the member is on the allow list of the group.
fetchGroupFileListFromServer Uses the pagination to get the shared files of the group from the server.
fetchAnnouncementFromServer Gets the group announcement from the server.
addMembers Adds users to the group.
inviteUser Invites users to join the group.
removeMembers Removes a member from the group.
blockMembers Adds the user to the block list of the group.
unblockMembers Removes users from the group block list.
changeGroupName Changes the group name.
changeGroupDescription Modifies the group description.
leaveGroup Leaves a group.
destroyGroup Destroys the group instance.
blockGroup Blocks group messages.
unblockGroup Unblocks group messages.
changeOwner Transfers the group ownership.
addAdmin Adds a group admin.
removeAdmin Removes a group admin.
muteMembers Mutes group members.
unMuteMembers Unmutes group members.
muteAllMembers Mutes all members.
unMuteAllMembers Unmutes all group members.
addAllowList Adds members to the allow list of the group.
removeAllowList Removes members from the allow list of the group.
uploadGroupSharedFile Uploads the shared file to the group.
downloadGroupSharedFile Downloads the shared file of the group.
removeGroupSharedFile Removes a shared file of the group.
updateGroupAnnouncement Updates the group announcement.
updateGroupExtension Updates the group extension field.
joinPublicGroup Joins a public group.
requestToJoinPublicGroup Requests to join a group.
acceptJoinApplication Accepts a join request.
declineJoinApplication Declines a join request.
acceptInvitation Accepts a group invitation.
declineInvitation Declines a group invitation.
addGroupListener Adds a group listener.
removeGroupListener Removes the group listener.
removeAllGroupListener Clears all group listeners.
Event Description
onInvitationReceived Occurs when the current user receives a group invitation.
onRequestToJoinReceived Occurs when a join request from the current user is received by the peer user.
onRequestToJoinAccepted Occurs when a join request from the current user is accepted by the peer user.
onRequestToJoinDeclined Occurs when a join request from the current user is declined by the peer user.
onInvitationAccepted Occurs when a group invitation from the current user is accepted by the peer user.
onInvitationDeclined Occurs when a group invitation from the current user is declined by the peer user.
onUserRemoved Occurs when the current user is removed from the group.
onGroupDestroyed Occurs when a group is destroyed.
onAutoAcceptInvitation Occurs when the group invitation is accepted automatically by the current user.
onMuteListAdded Occurs when one or more members are added to the mute list of the group.
onMuteListRemoved Occurs when one or more members are removed from the mute list of the group.
onAdminAdded Occurs when a member is set as an admin.
onAdminRemoved Occurs when the administrative privileges of an admin are removed.
onOwnerChanged Occurs when the group ownership is transferred.
onMemberJoined Occurs when a user joins a group.
onMemberExited Occurs when a member voluntarily leaves the group.
onAnnouncementChanged Occurs when the group announcement is updated.
onSharedFileAdded Occurs when a shared file is added to the group.
onSharedFileDeleted Occurs when a shared file is removed from a group.
onAllowListAdded Occurs when one or more group members are added to the allow list.
onAllowListRemoved Occurs when one or more group members are removed from the allow list.
onAllGroupMemberMuteStateChanged Occurs when all group members are muted or unmuted.
onDetailChanged Occurs when the chat group detail change. All chat group members receive this event.
onStateChanged Occurs when the disabled state of group changes.
onMemberAttributesChanged Occurs when a custom attribute(s) of a group member is/are changed.

ChatRoomManager

Method Description
setNativeListener The chat room manager class, which manages user operations, like joining and leaving the chat room and retrieving the chat room list, and manages member privileges.
addRoomListener Adds a chat room listener.
removeRoomListener Removes the chat room listener.
removeAllRoomListener Removes all the chat room listeners.
joinChatRoom Joins the chat room.
leaveChatRoom Leaves the chat room.
fetchPublicChatRoomsFromServer Gets chat room data from the server with pagination.
fetchChatRoomInfoFromServer Gets the details of the chat room from the server.
getChatRoomWithId Gets the chat room by ID from the local database.
createChatRoom Creates a chat room.
destroyChatRoom Destroys a chat room.
changeChatRoomSubject Changes the chat room name.
changeChatRoomDescription Modifies the chat room description.
fetchChatRoomMembers Gets the chat room member list.
muteChatRoomMembers Mutes the specified members in a chat room.
unMuteChatRoomMembers Unmutes the specified members in a chat room.
changeOwner Transfers the chat room ownership.
addChatRoomAdmin Adds a chat room admin.
removeChatRoomAdmin Removes administrative privileges of a chat room admin.
fetchChatRoomMuteList Uses the pagination to get the list of members who are muted in the chat room.
removeChatRoomMembers Removes the specified members from a chat room.
blockChatRoomMembers Adds the specified members to the block list of the chat room.
unBlockChatRoomMembers Removes the specified members from the block list of the chat room.
fetchChatRoomBlockList Gets the chat room block list with pagination.
updateChatRoomAnnouncement Updates the chat room announcement.
fetchChatRoomAnnouncement Gets the chat room announcement from the server.
fetchChatRoomAllowListFromServer Gets the allow list from the server.
isMemberInChatRoomAllowList Checks whether the member is on the allow list of the chat room.
addMembersToChatRoomAllowList Adds members to the allow list of the chat room.
removeMembersFromChatRoomAllowList Removes members from the allow list of the chat room.
muteAllChatRoomMembers Mutes all members.
unMuteAllChatRoomMembers Unmutes all members of the chat room.
fetchChatRoomAttributes Gets custom chat room attributes from the server.
addAttributes Sets custom chat room attributes.
removeAttributes Removes custom chat room attributes.
Event Description
onChatRoomDestroyed Occurs when the chat room is destroyed.
onMemberJoined Occurs when a user joins the chat room.
onMemberExited Occurs when a member voluntarily leaves the chat room.
onRemoved Occurs when a member is removed from a chat room.
onMuteListAdded Occurs when a chat room member is added to the mute list.
onMuteListRemoved Occurs when one or more chat room members are removed from the mute list.
onAdminAdded Occurs when a chat room member is set as an admin.
onAdminRemoved Occurs when the administrative privileges of a chat room admin are removed.
onOwnerChanged Occurs when the chat room ownership is transferred.
onAnnouncementChanged Occurs when the chat room announcement changes.
onAllowListAdded Occurs when one or more chat room members are added to the allow list.
onAllowListRemoved Occurs when one or more chat room members are removed from the allow list.
onAllChatRoomMemberMuteStateChanged Occurs when all members in the chat room are muted or unmuted.
onSpecificationChanged Occurs when the chat room specifications change. All chat room members receive this event.
onAttributesUpdated Occurs when the custom chat room attributes (key-value) are updated.
onAttributesRemoved Occurs when the custom chat room attributes (key-value) are removed.

ChatPresenceManager

Method Description
setNativeListener The presence manager class.
addPresenceListener Adds a presence listener.
removePresenceListener Removes a presence listener.
removeAllPresenceListener Clears all presence listeners.
publishPresence Publishes a custom presence state.
subscribe Subscribes to the presence state of a user.
unsubscribe Unsubscribes from the presence state of the unspecified users.
fetchSubscribedMembers Uses the pagination to get a list of users whose presence states you have subscribed to.
fetchPresenceStatus Gets the current presence state of specified users.
Event Description
onPresenceStatusChanged Occurs when the presence state of a subscribed user changes.

ChatPushManager

Method Description
setNativeListener The class for message push configuration options.
setSilentModeForConversation Sets the offline push for the conversation.
removeSilentModeForConversation Clears the offline push settings of the conversation.
fetchSilentModeForConversation Gets the offline push settings of the conversation.
setSilentModeForAll Sets the offline push of the app.
fetchSilentModeForAll Gets the do-not-disturb settings of the app.
fetchSilentModeForConversations Gets the do-not-disturb settings of the specified conversations.
setPreferredNotificationLanguage Sets the target translation language of offline push notifications.
fetchPreferredNotificationLanguage Gets the configured push translation language.
updatePushNickname Updates nickname of the sender displayed in push notifications.
updatePushDisplayStyle Updates the display style of push notifications.
fetchPushOptionFromServer Gets the push configurations from the server.

ChatUserInfoManager

Method Description
updateOwnUserInfo Modifies the user attributes of the current user.
fetchUserInfoById Gets the user attributes of the specified users.
fetchOwnInfo Gets attributes of the current user from the server.

ChatMessage

Method Description
constructor Constructs a message.
createTextMessage Creates a text message for sending.
createFileMessage Creates a message with a file attachment for sending.
createImageMessage Creates an image message for sending.
createVideoMessage Creates a video message for sending.
createVoiceMessage Creates a voice message for sending.
createLocationMessage Creates a location message for sending.
createCmdMessage Creates a command message for sending.
createCustomMessage Creates a custom message for sending.
createReceiveMessage Creates a received message instance.
reactionList Gets the list of Reactions.
groupReadCount Gets the count of read receipts of a group message.
threadInfo Gets details of a message thread.
messagePriority Set the chat room message priority.

ChatConversation

Method Description
name Gets the conversation ID.
getUnreadCount Gets the count of unread messages in the conversation.
getLatestMessage Gets the latest message from the conversation.
getLatestReceivedMessage Gets the latest message received in the conversation.
setConversationExtension Sets the extension information of the conversation.
markMessageAsRead Marks a message as read.
markAllMessagesAsRead Marks all messages as read.
updateMessage Updates a message in the local database.
deleteMessage Deletes a message from the local database.
deleteMessagesWithTimestamp Deletes messages sent or received in a certain period from the local database.
deleteAllMessages Deletes all the messages of the conversation.
getMessagesWithMsgType Retrieves messages of a certain type that a specified user sends in a conversation.
getMessages Retrieves messages of a certain quantity in a conversation from the local database.
getMessagesWithKeyword Retrieves messages with keywords in a conversation in the local database.
getMessageWithTimestamp Gets messages that are sent and received in a certain period in a conversation in the local database.
fetchHistoryMessages Uses the pagination to get messages in the specified conversation from the server.

Generated using TypeDoc