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(); }
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(); }