Conversation Overview
A conversation refers to the logical relationship automatically established and maintained by the IMLib SDK based on information such as the sender, recipient, and conversation type of each message. It is an abstract concept.
Conversation Types
RC supports multiple conversation types to meet different business scenario requirements. The IMLib SDK uses the ConversationType enumeration to represent various 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.ULTRA_GROUP | Ultra Group Chat |
| ConversationType.CHATROOM | Chatroom |
| ConversationType.SYSTEM | System Conversation |
The ConversationType enumeration also defines other conversation types, which are now deprecated and no longer maintained.
One-to-One Chat
Refers to one-on-one communication between two users, who may be friends or strangers. RC does not manage user relationships but is responsible for establishing and maintaining the conversation relationship.
Messages with storage attributes in one-to-one conversations are saved in the client's local database.
Group Chat
A group chat involves communication among more than two users. Group member information is provided and maintained by the App, while RC is only responsible for delivering messages to all group members. Each group can have up to 3,000 members, and there is no limit to the number of groups within an App.
Messages with storage attributes in group conversations are saved in the client's local database.
Ultra Group Chat
Ultra group chat refers to a multi-user chat service with no member limit, supporting massive concurrent message delivery and push notification services. Group member information is provided and maintained by the App, while RC is responsible for delivering messages to group members. There is no limit to the number of ultra groups in an App, and ultra groups have no member limit. A single user can join up to 100 ultra groups.
Messages in ultra group conversations are saved in the client's local database. For more details, refer to Ultra Group Overview.
Chatroom
Chatrooms have no user limit and support massive concurrent message delivery. Users who leave a chatroom will no longer receive any messages from it, and there is no push notification functionality. RC is responsible for establishing and maintaining the conversation relationship. Users can join or leave chatrooms using the relevant SDK interfaces.
The SDK does not save chatroom messages. All chatroom data is cleared when a user exits. For more details, refer to Chatroom Overview.
System Conversation
A system conversation is established when a system account sends messages to users. This type of conversation can be created by calling the broadcast interface to send broadcasts or by sending single notification messages such as friend requests.
Conversation Entity Class
The conversation entity class encapsulated in the client SDK is Conversation. All conversation-related information is obtained from this class.
The following table lists the main properties provided by Conversation:
| Property Name | Type | Description |
|---|---|---|
| targetId | String | Conversation ID (or Target ID), used to identify the conversation counterpart.
|
| channelId | String | The business identifier of the conversation to which the message belongs, applicable only to ultra groups. |
| portraitUrl | String | The URL of the avatar in the conversation. |
| unreadMessageCount | String | The number of unread messages in the conversation. |
| isTop | boolean | Whether the conversation is pinned. |
| isTopForTag | boolean | The pinned status of the current conversation under this tag. 1. Only valid when retrieving conversations by tag. |
| conversationTitle | String | The title of the conversation. |
| conversationType | ConversationType | The conversation type, as described in detail above. |
| latestMessage | MessageContent | The content of the last message stored locally in the client for this conversation. For details about message storage attributes, refer to the description of MessageTag in Message Overview. |
| latestMessageId | int | The ID of the last message stored locally in the client for this conversation. |
| draft | String | Draft information saved in the conversation. Refer to Draft Details. |
| operationTime | long | The operation time (Unix timestamp in milliseconds) for this conversation, used when paginating the conversation list. 1. The initial value is the same as sentTime; operations like pinning will update this timestamp. |
| receivedTime | 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 when the message arrives at the recipient's client. |
| sentTime | 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 successfully sent or received, this is the time the message arrived at the RC server. 2. When the last message is a failed message, this is 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 is the draft save time. |
| receivedStatus | Message.ReceivedStatus | The receive status of the last message in the conversation. |
| sentStatus | Message.SentStatus | The send status of the last message in the conversation. |
| objectName | String | The type name of the last message in the conversation, corresponding to the message content body. The objectName for predefined message types is listed in Message Type Overview. For custom message types, objectName is the value you specify. |
| senderUserId | String | The sender ID of the last message in the conversation. |
| senderUserName | String | The sender's name. This field is for internal SDK use only. |
| notificationStatus | ConversationNotificationStatus | The Do Not Disturb status of the conversation. |
| mentionedCount | int | The number of messages in this conversation where you were mentioned. |
| mentionedMeCount | int | The number of messages in an ultra group conversation where you were mentioned. |
| latestMessageDirection | Message.MessageDirection | The direction of the last message in the conversation, either sent or received. |
| latestMessageExtra | String | Additional information for the last message in the conversation. |
| latestMessageUId | String | 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 | ReadReceiptInfo | The read receipt status of the last message in the conversation, applicable only to group chats. |
| latestMessageConfig | MessageConfig | The configuration information for the last message in the conversation. |
| latestCanIncludeExpansion | boolean | Whether the last message in the conversation allows message expansion. 1. This property is determined when the message is sent and cannot be modified afterward. 2. Expansion information is only supported for one-to-one, group, and ultra group chats; other conversation types cannot set expansion information. |
| latestExpansion | Map<String, String> | The expansion information for the last message in the conversation. For details, refer to Message Expansion. |
| pushNotificationLevel | int | The Do Not Disturb level of the conversation. For details, refer to Do Not Disturb Overview. |
| channelType | IRongCoreEnum.UltraGroupChannelType | Starting from version 5.2.4, ultra group channel types are supported, including public and private channels. |
| firstUnreadMsgSendTime | long | Starting from version 5.2.5, the timestamp of the first unread message in the conversation is supported, applicable only to ultra groups. |