예제 #1
0
        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}");
        }
예제 #2
0
        private static void Server_WebSocketDisconnected(WebServer.WebSockets.WebSocket WebSocket)
        {
            Console.WriteLine($"> (WebSocket Disconnected)");
            int Idx = WebSockets.IndexOf(WebSocket);

            if (Idx > -1)
            {
                WebSockets.RemoveAt(Idx);
            }
        }
예제 #3
0
        private static void Server_WebSocketConnected(WebServer.WebSockets.WebSocket WebSocket)
        {
            Console.WriteLine($"> (WebSocket Connected)");
            int Idx = WebSockets.IndexOf(WebSocket);

            if (Idx == -1)
            {
                WebSockets.Add(WebSocket);
            }
        }