Sending And Receiving Messages In A Group

All members that are in a group may send and receive messages freely.

The example code below shows how to send a message and the event listener callback for receiving messages from remote member clients.

// Group ID to send the message to
string groupID = "xxxxxx";

// Message data to be sent to other member clients
uint8_t* message = GroupBroadcastMessageData;

// This event is raised when a remote member client sends a message via BroadcastTo
REG_EVENT(group->GetMemberBroadcastEvent(), [this](void*, const DiarkisPayloadEventArgs& e)
{
this->OnMemberBroadcast(e);
});


// If you are using UDP client and setting this flag to true, the message will be delivered as an RUDP message
bool reliable = true;

group->BroadcastTo(groupID, message, message.size(), reliable);