新しいグループを作成する

グループは参加人数に制限がなく参加したクライアント間で同期をとることが可能です。

以下のコード例はグループの作成とサーバからのレスポンスの受け取りを説明した例になります。

// 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)
{
this->OnCreate(e);
});

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