Ejemplo n.º 1
0
        private async Task OpenWebSocketAsync()
        {
            connection = null;

            connection          = new WebSocketConnection(config, logger);
            connection.OnError += WebSocket_OnError;
            connection.OnClose += WebSocket_OnClose;
            ConnectAckCode code = await connection.OpenAsync();

            restarting = false;
            this.logger?.LogDebug($"VRTU web socket client opened with code '{code}'");

            if (code != ConnectAckCode.ConnectionAccepted)
            {
                OnError?.Invoke(this, new AdapterErrorEventArgs(Id, new Exception($"SCADA adapter failed to open web socket with code = {code}")));
            }
        }