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)); }
public async Task CloseAsync() { try { if (this.websocketManager != null) { await this.websocketManager.CloseAsync(); this.websocketManager.Dispose(); } } catch (Exception ex) { } finally { this.websocketManager = null; } }
public void Dispose() { try { this.CloseAsync().Wait(); } catch (ObjectDisposedException) { } catch (AggregateException ae) { ae.Handle( ex => { return(true); }); } finally { this.websocketManager = null; } }