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

Leave a group

OpenIM uni-app / uni-app x SDK guide for Leave a group.

Copy

quitGroup() leaves one joined group for the current account.

import { quitGroup } from '@/uni_modules/unix-openim-sdk'

await quitGroup(groupID)

Ask for confirmation. The owner normally cannot leave directly and must first transfer ownership or dismiss the group. After success, close the group chat and reconcile through a joined-group deletion event or a new query.

Promise success means that the leave request completed, not that group-list and member events have arrived. Remove this account's chat entry, member pages, and send permission by groupID; other members retain the group.

Serialize ownership transfer and leave: confirm the new owner through an event or query before calling quitGroup(). Preserve chat and group state on failure instead of deleting it only because the user confirmed the dialog.