How To Create A New Group

A group do not have limitation on how many clients may join the group.

The code example below shows how to create a new group and receive a server response on creating a new group.

// When setting this flag to true, the group will not be discarded when it becomes empty of clients
// The duration of the empty group to be kept is dictated by ttl
bool allowEmpty = true;

// When setting this flag to true, the client that creates the group will automatically join the group created
bool join = true;

// TTL of an empty group. TTL is only effective if allowEmpty is true
// TTL is in seconds
uint16_t ttl = 60;

// This is the event listener callback for group creation
REG_EVENT(group->GetCreateEvent(), [this](void*, const DiarkisGroupEventArgs& e)

// Create a new group on the server
group->Create(allowEmpty, bool join, uint16_t ttl);

Last updated