Conversations overview
Understand the responsibilities of OIMConversationInfo, conversationID, conversation settings, and conversation events in OpenIM iOS SDK.
In OpenIMSDK, a conversation is the client-side chat state maintained for a one-to-one or group chat. One OIMConversationInfo record represents that state for the signed-in user. It stores list-related state such as the unread count, latest message, pinned status, draft, message-reception option, and extension field. A conversation record and its chat target have separate identifiers: conversationID locates the current account's conversation state, while a one-to-one target uses the other user's userID and a group-chat target uses its groupID.
Both one-to-one and group chats use conversation records for chat-list state. Group profiles, membership, and permissions remain under the Group APIs. A group-chat page therefore uses groupID for group capabilities and conversationID for conversation settings, unread counts, drafts, and message history.
Conversation identifiers
For a one-to-one conversation, sourceID is the target user's ID and the conversation type is OIMConversationTypeC2C. For a group conversation, sourceID is the groupID and the conversation type is OIMConversationTypeGroup. Call getConversationIDBySessionType:sourceID: to obtain a stable conversationID, then use it for conversation settings, read status, hiding, and message cleanup.
| Identifier | Purpose |
|---|---|
conversationID | The current account's conversation-record ID, used for conversation settings, message history, and unread state. |
userID | The other user's ID in a one-to-one chat. |
groupID | The group ID for a group chat and the target identifier used by Group APIs. |
sourceID | The chat-target ID used in a type-based lookup: userID for a one-to-one chat or groupID for a group chat. |
OIMConversationInfo
| Property | Description |
|---|---|
conversationID | The conversation ID. |
conversationType | The OIMConversationType value. |
userID / groupID | The user or group identifier for the chat. |
showName / faceURL | The conversation's current display name and avatar. |
unreadCount | The current unread count for the conversation. |
latestMsg / latestMsgSendTime | The latest message and its send time. |
recvMsgOpt | The OIMReceiveMessageOpt message-reception option. |
groupAtType | The OIMGroupAtType group-mention state. |
draftText / draftTextTime | The draft and its last update time. |
isPinned | Whether the conversation is pinned. |
isPrivateChat / burnDuration | The private-chat state and burn-after-reading duration. |
isNotInGroup | Whether the current user is no longer in the group. |
attachedInfo | Additional SDK information. |
ex | A conversation extension string whose format is defined by your application. |
Queries and settings
- Retrieve a conversation by chat target
- Retrieve conversations by ID
- Retrieve the conversation list
- Pin or unpin a conversation
- Set message reception for a conversation
- Enable or disable burn after reading
- Set the burn-after-reading duration
- Periodically delete server-side messages
- Reset group-mention state
- Set the conversation extension field
- Set a conversation draft
- Mark a conversation as read
- Maintain the total unread count
Conversation lifecycle
Conversation groups
Conversation groups overview explains how to organize conversations into custom groups. A group member is identified by conversationID, while the group itself uses conversationGroupID. This organization affects only the current account's conversation list. It does not create a chat group or change its groupID, profile, or membership.
The iOS enterprise SDK exposes this capability through the OpenIMCore JSON interface bundled with the SDK and merges incremental updates through one conversation-group listener. Query results establish group snapshots. Group events update records by conversationGroupID, while membership events use conversationGroupID + conversationID. The overview describes these data boundaries, provides the complete listener setup, and links to every individual API page.
State updates
Queries establish page snapshots, and delegates merge subsequent changes:
- New conversations and conversation-property changes are handled on Retrieve the conversation list.
- Changes to the current account's total unread count are handled on Maintain the total unread count.
This overview identifies event ownership without registering delegates again. Handle an operation's success callback, delegate updates, and reconciliation queries separately. Do not infer final conversation state solely from the action the user initiated.
Was this page helpful?