Ejemplo n.º 1
0
        public async Task <bool> ConnectAsync(string serviceName)
        {
            //Uri serviceAddress = new Uri(new Uri(serviceName), ServiceConst.DataApiWebsockets);
            if (this.websocketManager == null)
            {
                this.websocketManager = new WebSocketManager();
            }
            Uri serviceAddress = new Uri("ws://127.0.0.1:3251/PublicGatewayWS");

            return(await this.websocketManager.ConnectAsync(serviceAddress));
        }
Ejemplo n.º 2
0
        public async Task CloseAsync()
        {
            try
            {
                if (this.websocketManager != null)
                {
                    await this.websocketManager.CloseAsync();

                    this.websocketManager.Dispose();
                }
            }
            catch (Exception ex)
            {
            }
            finally
            {
                this.websocketManager = null;
            }
        }
Ejemplo n.º 3
0
 public void Dispose()
 {
     try
     {
         this.CloseAsync().Wait();
     }
     catch (ObjectDisposedException)
     {
     }
     catch (AggregateException ae)
     {
         ae.Handle(
             ex =>
         {
             return(true);
         });
     }
     finally
     {
         this.websocketManager = null;
     }
 }