Joining A Group

By joining a group, you may send and receive messages with the other member clients in the group.

Diarkis Group allows you to join multiple groups at a time.

The example below shows how to join a group and handling of server response and an event listener callback for remote clients joining the group that 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 joining a group
REG_EVENT(tcpGroup->GetJoinEvent(), [this](void*, const DiarkisGroupEventArgs& e)

// This event is raised when a remote client joins the group you have joined
REG_EVENT(tcpGroup->GetMemberJoinEvent(), [this](void*, const DiarkisPayloadEventArgs& e)

group->Join(groupID, message);