private void Channel_OnClose(object sender, ChannelCloseEventArgs e) { shutdown = true; logger?.LogInformation("SCADA client channel is closed."); try { connection.CloseAsync().GetAwaiter(); logger?.LogDebug("Closing VRTU Web socket connection."); } catch { } connection = null; OnClose?.Invoke(this, new AdapterCloseEventArgs(Id)); }
private async void SendCloseWhenOutputCompleted() { await _output.Reading; await _webSocket.CloseAsync(); }