Browse SDKs · uni-app / uni-app x
SDKsuni-app

Group overview

OpenIM uni-app / uni-app x SDK guide for Group overview.

Copy

The group domain uses groupID as its stable primary key and includes group profiles, members, applications, and permissions. Group name, avatar, announcement, owner, and member count are mutable snapshots.

Core data types

TypeUse case
OpenIMGroupItemJoined-group lists, group profile pages, and group state.
OpenIMCreateGroupInfoName, type, announcement, introduction, avatar, and extension submitted when creating a group.
OpenIMGroupMemberItemMember profile, role, join source, and mute-end time.
OpenIMGroupApplicationItemJoin application, applicant, and processing state.

Common OpenIMGroupItem fields include groupID, groupName, notification, introduction, faceURL, ownerUserID, memberCount, status, groupType, needVerification, lookMemberInfo, applyMemberFriend, and ex. attachedInfo is an Enterprise field; parse it only according to a confirmed contract.

Use groupID:userID as the stable merge key for a member. A member's in-group nickname and faceURL are member snapshots and must not overwrite account-level profile data.

Find a task

TaskPage
Create, update, dismiss, or leave a groupCreate a group, Update a group, Dismiss a group, Leave a group
Page through joined groups or query selected profilesList joined groups by page, Get specified groups
Query, search, and manage membersList group members, Search group members
Invite or remove members and transfer ownershipInvite users, Remove members, Transfer ownership
Send, query, and process join applicationsJoin a group, Get received group applications
Configure mute, verification, and member permissionsUse the corresponding group-settings and member-management pages.

State updates

This page owns the four group-profile and joined-list events. Subscribe before querying the joined-group snapshot.

import {
  off,
  onGroupDismissed,
  onGroupInfoChanged,
  onJoinedGroupAdded,
  onJoinedGroupDeleted,
  type OpenIMSDKEventSubscription,
} from '@/uni_modules/unix-openim-sdk'

const infoSubscription = onGroupInfoChanged((group) => upsertGroup(group.groupID, group))
const subscriptions : Array<OpenIMSDKEventSubscription> = [
  infoSubscription,
  onGroupDismissed((group) => removeGroup(group.groupID)),
  onJoinedGroupAdded((group) => upsertGroup(group.groupID, group)),
  onJoinedGroupDeleted((group) => removeGroup(group.groupID)),
]
subscriptions.forEach((subscription) => off(subscription))

Merge every event idempotently by groupID. Dismissal, active leave, and removal by another member have different business causes, but each can require closing the current chat page.

onGroupInfoChanged updates profile data, onGroupDismissed means the group was dismissed, and onJoinedGroupAdded / onJoinedGroupDeleted update the current account's joined-group list. Promise success, event arrival, and requery are three stages. Requery snapshots after App restoration, synchronization, or re-login.

Treat roles, mute state, join policy, and commercial extensions as server-authoritative. Degrade when fields are absent instead of inventing default permission. Stop sending and clear the member store when the current user can no longer access the group. Release every owned handle on logout or group-store destruction.