Friends

If you want to associate friends with your users, you must handle friend management in your app.
Once two users are friends (i.e. they have accepted each other as friends), then you can associate them as friends in CometChat.

The following table lists the properties that the Friends API supports

ParametersTypeDescription
acceptedarray of strings(optional) Indicates an array of UIDs that are to be made friends.
Maximum of 25 users can be passed in the accepted array.

The following table lists the most common error codes the Friend API may return in case of an error.

CodeDescription
ERR_ALREADY_FRIENDIndicates that the users are already friends.
ERR_NOT_A_FRIENDIndicates unfriending non-friended users.
ERR_CANNOT_FORM_SELF_RELATIONIndicates user cannot friend himself.
ERR_FAILED_TO_ADD_FRIENDIndicates that the API has failed to add a friend.