Skip to main content

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 ValueConversation Type
ConversationType.PRIVATEOne-to-One Chat
ConversationType.GROUPGroup Chat
ConversationType.ULTRA_GROUPUltra Group Chat
ConversationType.CHATROOMChatroom
ConversationType.SYSTEMSystem 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 NameTypeDescription
targetIdStringConversation ID (or Target ID), used to identify the conversation counterpart.
  • For one-to-one chats, the conversation ID directly uses the other user's ID.
  • For groups, chatrooms, and ultra groups, it is the corresponding group, chatroom, or ultra group ID.
  • For system conversations, it is the system account ID specified by the developer.
channelIdStringThe business identifier of the conversation to which the message belongs, applicable only to ultra groups.
portraitUrlStringThe URL of the avatar in the conversation.
unreadMessageCountStringThe number of unread messages in the conversation.
isTopbooleanWhether the conversation is pinned.
isTopForTagbooleanThe pinned status of the current conversation under this tag.
1. Only valid when retrieving conversations by tag.
conversationTitleStringThe title of the conversation.
conversationTypeConversationTypeThe conversation type, as described in detail above.
latestMessageMessageContentThe 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.
latestMessageIdintThe ID of the last message stored locally in the client for this conversation.
draftStringDraft information saved in the conversation. Refer to Draft Details.
operationTimelongThe 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.
receivedTimelongThe 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.
sentTimelongThe 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.
receivedStatusMessage.ReceivedStatusThe receive status of the last message in the conversation.
sentStatusMessage.SentStatusThe send status of the last message in the conversation.
objectNameStringThe 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.
senderUserIdStringThe sender ID of the last message in the conversation.
senderUserNameStringThe sender's name. This field is for internal SDK use only.
notificationStatusConversationNotificationStatusThe Do Not Disturb status of the conversation.
mentionedCountintThe number of messages in this conversation where you were mentioned.
mentionedMeCountintThe number of messages in an ultra group conversation where you were mentioned.
latestMessageDirectionMessage.MessageDirectionThe direction of the last message in the conversation, either sent or received.
latestMessageExtra StringAdditional information for the last message in the conversation.
latestMessageUIdStringThe 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.
latestMessageReadReceiptInfoReadReceiptInfoThe read receipt status of the last message in the conversation, applicable only to group chats.
latestMessageConfigMessageConfigThe configuration information for the last message in the conversation.
latestCanIncludeExpansionbooleanWhether 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.
latestExpansionMap<String, String>The expansion information for the last message in the conversation. For details, refer to Message Expansion.
pushNotificationLevelintThe Do Not Disturb level of the conversation. For details, refer to Do Not Disturb Overview.
channelTypeIRongCoreEnum.UltraGroupChannelTypeStarting from version 5.2.4, ultra group channel types are supported, including public and private channels.
firstUnreadMsgSendTimelongStarting from version 5.2.5, the timestamp of the first unread message in the conversation is supported, applicable only to ultra groups.