コード例 #1
0
ファイル: ChatComponent.cs プロジェクト: kokizzu/MagicOnion
        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();
                }
            }
        }
コード例 #2
0
 private async void _waitDisConnect()
 {
     try
     {
         await _chatHub.WaitForDisconnect();
     }
     catch (Exception e)
     {
         _shutdown();
     }
 }
コード例 #3
0
ファイル: TestExecution.cs プロジェクト: zuoann301/MagicOnion
 async void RegisterDisconnect(IChatHub client)
 {
     try
     {
         // you can wait disconnected event
         await client.WaitForDisconnect();
     }
     finally
     {
         // try-to-reconnect? logging event? etc...
         Debug.Log("disconnected");
     }
 }