Example #1
0
        private async void RegisterDisconnectEvent(IChatHub streamingClient)
        {
            try
            {
                // you can wait disconnected event
                await streamingClient.WaitForDisconnect();
            }
            catch (Exception e)
            {
                Debug.LogError(e);
            }
            finally
            {
                // try-to-reconnect? logging event? close? etc...
                Debug.Log($"disconnected from the server.");

                if (this.isSelfDisConnected)
                {
                    // there is no particular meaning
                    await Task.Delay(2000);

                    // reconnect
                    await this.ReconnectServerAsync();
                }
            }
        }
 private async void _waitDisConnect()
 {
     try
     {
         await _chatHub.WaitForDisconnect();
     }
     catch (Exception e)
     {
         _shutdown();
     }
 }
Example #3
0
 async void RegisterDisconnect(IChatHub client)
 {
     try
     {
         // you can wait disconnected event
         await client.WaitForDisconnect();
     }
     finally
     {
         // try-to-reconnect? logging event? etc...
         Debug.Log("disconnected");
     }
 }