When you leave from a group, a message is sent to the other member clients of the group to notify that you have left the group.
The example code below shows how to leave from a group, the handling of the server response from leaving and the event listener callback for other member clients leaving the group you have joined.
// This is the group ID that you are trying to join
string groupID = "xxxxxx";
// This is the message to be sent to other group members when you successfully join the group
const vector<uint8_t> message = groupJoinMessageData;
// This is the event listener callback for the server response when leaving a group
REG_EVENT(group->GetLeaveEvent(), [this](void*, const DiarkisGroupEventArgs& e)
{
this->OnLeave(e);
});
// This event is raised when a remote member client leaves the group you have joined
REG_EVENT(group->GetMemberLeaveEvent(), [this](void*, const DiarkisGroupEventArgs& e)
{
this->OnMemberLeave(e);
});
group->:Leave(groupID, message);