public async Task InvokeAsync(HttpContext context)
 {
     if (context.WebSockets.IsWebSocketRequest)
     {
         var wsSession = WebSocketSession.New(context, _messagePipeline);
         socketManager.AddSocketSession(wsSession);
         await wsSession.HandleAsync(context.RequestAborted).ConfigureAwait(false);
     }
     else
     {
         await _next(context).ConfigureAwait(false);
     }
 }
Exemple #2
0
        public async Task InvokeAsync(HttpContext context)
        {
            if (context.WebSockets.IsWebSocketRequest)
            {
                IRequestExecutor executor = await GetExecutorAsync(context.RequestAborted);

                var messagePipeline = executor.Services.GetRequiredService <IMessagePipeline>();

                await WebSocketSession
                .New(context, messagePipeline)
                .HandleAsync(context.RequestAborted);
            }
            else
            {
                await NextAsync(context);
            }
        }