SDKsHarmonyOSEnterprise
Leave group
Depart from a group that the current account is currently a member of.
Regular members and administrators can voluntarily leave a group. The group owner cannot leave directly without first transferring ownership to another member via Transfer group ownership:
Code example
import sdk, { QuitGroupReq } from '@openimsdk/imsdk';
const request: QuitGroupReq = { groupID: groupID };
await sdk.quitGroup(request);Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
groupID | string | Yes | Identifier of the group to leave. |
Return value
Returns a Promise that resolves to void when the departure request succeeds on the server.
State changes after the call
Resolving the Promise confirms departure. When EventOnJoinedGroupDeleted fires, remove the group record matched by groupID from the joined groups list; see Group overview for listener patterns. Leaving a group does not automatically delete or hide local chat history; handle conversation lifecycle independently.
Was this page helpful?