public async Task <bool> ConnectAsync(Uri serviceAddress)
        {
            if (this.websocketManager == null)
            {
                this.websocketManager = new WebSocketManager();
            }

            return(await this.websocketManager.ConnectAsync(serviceAddress));
        }
        public async Task<bool> ConnectAsync(Uri serviceAddress)
        {
            if (this.websocketManager == null)
            {
                this.websocketManager = new WebSocketManager();
            }

            return await this.websocketManager.ConnectAsync(serviceAddress);
        }
 public async Task CloseAsync()
 {
     try
     {
         if (this.websocketManager != null)
         {
             await this.websocketManager.CloseAsync();
             this.websocketManager.Dispose();
         }
     }
     catch (Exception ex)
     {
         Logger.Error(ex, "");
     }
     finally
     {
         this.websocketManager = null;
     }
 }
        public async Task CloseAsync()
        {
            try
            {
                if (this.websocketManager != null)
                {
                    await this.websocketManager.CloseAsync();

                    this.websocketManager.Dispose();
                }
            }
            catch (Exception ex)
            {
                Logger.Error(ex, "");
            }
            finally
            {
                this.websocketManager = null;
            }
        }
 public void Dispose()
 {
     try
     {
         this.CloseAsync().Wait();
     }
     catch (ObjectDisposedException)
     {
     }
     catch (AggregateException ae)
     {
         ae.Handle(
             ex =>
         {
             Logger.Error(ex, "");
             return(true);
         });
     }
     finally
     {
         this.websocketManager = null;
     }
 }
 public void Dispose()
 {
     try
     {
         this.CloseAsync().Wait();
     }
     catch (ObjectDisposedException)
     {
     }
     catch (AggregateException ae)
     {
         ae.Handle(
             ex =>
             {
                 Logger.Error(ex, "");
                 return true;
             });
     }
     finally
     {
         this.websocketManager = null;
     }
 }