Conversation Overview
A conversation refers to the logical relationship automatically established and maintained by the RC SDK based on information such as the sender, receiver, and conversation type of each message. It is an abstract concept.
Conversation Types
RC supports multiple conversation types to meet various business scenarios. The client SDK uses the RCConversationType
enumeration to represent different conversation types. The meanings of each enumeration value are as follows:
Enumeration Value | Conversation Type |
---|---|
ConversationType_PRIVATE | one-to-one chat |
ConversationType_GROUP | group chat |
ConversationType_ULTRAGROUP | ultra group chat |
ConversationType_CHATROOM | chatroom chat |
ConversationType_SYSTEM | system conversation |
The RCConversationType
enumeration also defines other conversation types, which are now deprecated and no longer maintained.
One-to-One Chat
A one-to-one chat involves two users chatting individually. The users can be friends or strangers. RC does not manage the relationship between users but is responsible for establishing and maintaining the conversation.
Messages in one-to-one conversations are stored in the client's local database.
Group Chat
A group chat involves two or more users chatting together. The group member information is provided and maintained by the app, while RC is responsible for delivering messages to all group members. Each group can have up to 3000 members, and there is no limit to the number of groups in the app.
Messages in group conversations are stored in the client's local database.
Chatroom Chat
A chatroom has no user limit, supporting high-concurrency message delivery. Users will not receive any messages from the chatroom after leaving, and there are no push notifications. The conversation relationship is established and maintained by RC. Users can join or leave the chatroom through the SDK's relevant interfaces.
The SDK does not store chatroom messages, and all data is cleared when the user leaves the chatroom. For more details, refer to the Chatroom Overview.
System Conversation
A system conversation is established when a system account sends a message to a user. This type of conversation can be created by sending a broadcast through the broadcast interface or by sending a single notification message, such as a friend request.
Conversation Entity Class
The conversation entity class encapsulated in the client SDK is RCConversation
. All conversation-related information is retrieved from this entity class.
The table below lists the main properties provided by RCConversation
.
Property | Type | Description |
---|---|---|
targetId | NSString | The conversation ID (or target ID) used to identify the other party in the conversation.
|
channelId | NSString | The business identifier of the conversation, limited to 20 characters. Only applicable to ultra groups. |
conversationTitle | NSString | The title of the conversation. |
conversationType | RCConversationType | The type of conversation, as described above. |
unreadMessageCount | Int | The number of unread messages in the conversation. |
isTop | BOOL | Whether the conversation is pinned. |
latestMessage | RCMessageContent | The content of the last message stored locally in the client for this conversation. For details on message storage properties, refer to the Message Overview. |
latestMessageId | long | The ID of the last message stored locally in the client for this conversation. |
draft | NSString | The draft information saved in the conversation. Refer to the Draft Details. |
objectName | NSString | The type name of the last message in the conversation, corresponding to the message content. The predefined message type's objectName can be found in the Message Type Overview. The ObjectName for custom message types is the value specified by the developer. |
receivedTime | long long | The receive time of the last message in the conversation. 1. The value is a Unix timestamp in milliseconds. 2. The receive time is the local time on the client when the message reaches the receiver. |
sentTime | long long | The send time of the last message in the conversation, as a Unix timestamp in milliseconds. 1. When the last message in the conversation is a successfully sent or received message, this method returns the time the message reached the RC server. 2. When the last message is a failed message, this method returns the local send time of the message. 3. When the conversation has draft information and the draft save time is later than the last message time, this method returns the draft save time. |
operationTime | long long | The operation time of the conversation (Unix timestamp, milliseconds), used as the timestamp when paginating the conversation list. The initial value is the same as sentTime, and operations like pinning will update this timestamp. |
receivedStatus | RCReceivedStatus | The receive status of the last message in the conversation. |
sentStatus | RCSentStatus | The send status of the last message in the conversation. |
senderUserId | NSString | The sender ID of the last message in the conversation. |
latestMessageDirection | RCMessageDirection | The direction of the last message in the conversation, either sent or received. |
latestMessageUId | NSString | The unique ID of the last message in the conversation. 1. Only successfully sent messages have a unique ID. 2. The ID is globally unique under the same AppKey. |
latestMessageReadReceiptInfo | RCReadReceiptInfo | The read receipt status of the last message in the conversation, only applicable to group chats. |
latestMessageMessageConfig | RCMessageConfig | The configuration information of the last message in the conversation. |
latestMessageCanIncludeExpansion | BOOL | Whether the last message in the conversation can include extended information. 1. This property is determined when the message is sent and cannot be modified afterward. 2. Extended information is only supported in one-to-one, group, and ultra group chats. Other conversation types cannot set extended information. |
latestExpansion | NSDictionary | The extended information list of the last message in the conversation. For details, refer to Message Extension. |
hasUnreadMentioned | BOOL | Whether there are unread mentioned messages in the conversation. |
mentionedCount | int | The number of messages in this conversation where the user has been mentioned. |
blockStatus | RCConversationNotificationStatus | The Do Not Disturb status of the conversation. |
notificationLevel | RCPushNotificationLevel | The Do Not Disturb level of the conversation. For details, refer to the Do Not Disturb Overview. |
channelType | RCUltraGroupChannelType | The channel type of the ultra group. This field is only valid when ConversationType is ultra group. It is 0 for non-ultra groups. |
firstUnreadMsgSendTime | long long | Starting from version 5.2.5, the send time of the first unread message in the conversation is supported, as a Unix timestamp in milliseconds. Only applicable to ultra group conversations. |