private void TelnetHandler_OnTelnetReceivedHandler(object sender, OnTelnetReceivedEventArgs e) { for (int i = 0; i < ConnectedWebsocketHandlers.Count; i++) { WebSocketHandler webSocketHandler = ConnectedWebsocketHandlers[i]; if (webSocketHandler.WebSocket.State == System.Net.WebSockets.WebSocketState.Open) { Command command = new Command("OnTelnetReceived", e.Message); Task.Run(async() => await webSocketHandler.Send(command)); } else { ConnectedWebsocketHandlers.Remove(webSocketHandler); i--; } } }
public void ConnectWebsocketHandler(WebSocketHandler webSocketHandler) { ConnectedWebsocketHandlers.Add(webSocketHandler); }