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

Delete a friend

Remove an established friendship between the authenticated user and a specified contact.

Copy

Invoke deleteFriend() to delete the friendship between the authenticated user and a specified contact. Pass the target friend's user ID directly.

Parameters

ParameterTypeRequiredDescription
friendUserIDstringYesThe user ID of the friend to remove.

Code example

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

await deleteFriend(friendUserID)

Return value

The Promise resolves with void once OpenIMServer processes the deletion request.

State changes after the call

A resolved Promise confirms that the deletion request succeeded on OpenIMServer; it does not indicate that the deletion event has been processed on all devices. Upon receiving onFriendDeleted, the client removes the friendship record matching userID from the active friend roster and related caches. For complete event registration and cleanup logic, see Get the friend list. If events might have been missed during a network interruption, re-query the friend list to calibrate state.