示例#1
0
        static async Task Acceptor(HttpContext hc, Func <Task> n)
        {
            if (!hc.WebSockets.IsWebSocketRequest)
            {
                return;
            }

            Console.WriteLine("---> Creating WebSocket");

            var socket = await hc.WebSockets.AcceptWebSocketAsync();

            var h = new SocketHandler(socket);
            await h.WorkLoop();
        }
示例#2
0
        static async Task Acceptor(HttpContext hc, Func <Task> n)
        {
            if (!hc.WebSockets.IsWebSocketRequest)
            {
                return;
            }

            var socket = await hc.WebSockets.AcceptWebSocketAsync();

            var h = new SocketHandler(socket);
            //await h.EchoLoop();

            await h.Send();
        }