Leave a Group
In order to stop receiving updates and messages for any particular joined group, you will have to leave the group using theleaveGroup() method.
- Swift
- Objective C
| Parameter | Description |
|---|---|
| GUID | The UID of the group you would like to leave |
Real-time Leave Group Event
In other words, as a member of a group, how do I know if someone has left it? If a user leaves any group, the members of the group receive a real-time event in theonGroupMemberLeft() method of the CometChatGroupDelegate. In order to receive user Events, you must add protocol conformance CometChatGroupDelegate as shown below :
- Swift
- Objective C
viewDidLoad() as CometChat.groupdelegate = self
Missed Group Member Left Events
In other words, as a member of a group, how do I know if someone has left it when my app is not running? When you retrieve the list of previous messages if a member has left any group that the logged-in user is a member of, the list of messages will contain anAction message. An Action message is a sub-class of BaseMessage class.
For the group member left event, in the Action object received, the following fields can help you get the relevant information-
action-leftactionBy- User object containing the details of the user who left the groupactionFor- Group object containing the details of the group the user has left