Setting Up Field With UDP Or TCP Client

Field is network protocol agnostic, but it needs either UDP or TCP client to handle messaging between clients.

Setting Up With TCP Client

shared_ptr<IDiarkisField> field = shared_ptr<IDiarkisField>(DiarkisCreateField());

REG_EVENT(field->GetDisappearEvent(), [this](void*, const string& remoteUid)
{
this->OnDisappear(e);
});

REG_EVENT(field->GetResponseSyncInitEvent(), [this](void*, const vector<vector<uint8_t>>& list)
{
this->OnSyncInit(e);
});

REG_EVENT(field->GetSyncEvent(), [this](void*, const vector<uint8_t>& msg)
{
this->OnSync(e);
});

field->SetupAsTcp(diarkisTcpClient);

Setting Up With UDP Client

shared_ptr<IDiarkisField> field = shared_ptr<IDiarkisField>(DiarkisCreateField());

REG_EVENT(field->GetDisappearEvent(), [this](void*, const string& remoteUid)
{
/* Do your thing here */
});

REG_EVENT(field->GetResponseSyncInitEvent(), [this](void*, const vector<vector<uint8_t>>& list)
{
/* Do your thing here */
});

REG_EVENT(field->GetSyncEvent(), [this](void*, const vector<uint8_t>& msg)
{
/* Do your thing here */
});

field->SetupAsTcp(diarkisUdpClient);