private static void Server_WebSocketMessage(WebServer.WebSockets.WebSocket Sender, WebServer.WebSockets.MessageEventArgs E) { string Message = E.GetString(); string Reply = $"Echo,{Message}"; Console.WriteLine($"> (WebSocket) {Message}"); Sender.Write(Reply); Console.WriteLine($"< (WebSocket) {Reply}"); }
private static void Server_WebSocketDisconnected(WebServer.WebSockets.WebSocket WebSocket) { Console.WriteLine($"> (WebSocket Disconnected)"); int Idx = WebSockets.IndexOf(WebSocket); if (Idx > -1) { WebSockets.RemoveAt(Idx); } }
private static void Server_WebSocketConnected(WebServer.WebSockets.WebSocket WebSocket) { Console.WriteLine($"> (WebSocket Connected)"); int Idx = WebSockets.IndexOf(WebSocket); if (Idx == -1) { WebSockets.Add(WebSocket); } }