- Help Center
- Diarkis C# SDK
- UDP Client
UDP Client Event - OnOffline
The event is raised when the connected server is preparing to go offline.
The client is recommended to terminate the current connection and re-establish a new connection when this event is raised.
udp.OnOffline += OnUdpOffline;
udp.OnConnect += OnUdpConnect;
private void OnUdpOffline()
{
// We set a flag, so we can perform re-connection in OnDisconnect event listener
reconnectFlag = true;
// We migrate to another server - This raises OnConnect event
udp.Migrate();
}
// bool reconnecting is set to true when the client re-establishes a connection
private void OnUdpConnect(bool reconnecting)
{
if (reconnectFlag)
{
}
// Continue with your live :)
}