public async Task Get()
        {
            var context = ControllerContext.HttpContext;

            if (context.WebSockets.IsWebSocketRequest)
            {
                WebSocket webSocket = await context.WebSockets.AcceptWebSocketAsync();

                await _handler.HandleAsync(webSocket);
            }
            else
            {
                context.Response.StatusCode = 400;
            }
        }
Пример #2
0
        public async Task Get(string username)
        {
            var context            = ControllerContext.HttpContext;
            var isWebSocketRequest = context.WebSockets.IsWebSocketRequest;

            if (isWebSocketRequest)
            {
                WebSocket webSocket = await context.WebSockets.AcceptWebSocketAsync();

                await _handler.HandleAsync(username, webSocket);

                //await SendMessage(webSocket);
            }
            else
            {
                context.Response.StatusCode = 400;
            }
        }