Join a Group
In order to start participating in group conversations, you will have to join a group. You can do so using thejoinGroup() method.
- Swift
- Objective C
joinGroup() method takes four parameters
| Parameter | Description |
|---|---|
| GUID | The GUID of the group you would like to join |
| groupType | Type of the group. CometChat provides 3 types of groups viz. .public .private .password |
| password | The password is mandatory in case of a .password protected the group. |
hasJoined parameter in the Group object.
Real-time Group Member Joined Events
In other words, as a recipient, how do I know when someone joins a group? To receive Real-Time Events for the same, you need to implement theonMemberAddedToGroup() method of the GroupListener class.
- Swift
- Objective C
Missed Group Member Joined Events
In other words, as a member of a group, how do I know if someone joins the group when my app is not running? When you retrieve the list of previous messages if a member has joined 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 joined the event, in the Action object received, the following fields can help you get the relevant information-
action-joinedactionBy- User object containing the details of the user who joined the groupactionFor- Group object containing the details of the group the user has joined