public WebSocketManagerMiddleware(RequestDelegate next, MessagesHandler webSocketHandler,
                                   IServiceScopeFactory serviceScopeFactory)
 {
     _next                = next;
     _webSocketHandler    = webSocketHandler;
     _serviceScopeFactory = serviceScopeFactory;
 }
 public static IApplicationBuilder MapWebSocketManager(this IApplicationBuilder app,
                                                       PathString path,
                                                       MessagesHandler handler)
 {
     return(app.Map(path, builder => builder.UseMiddleware <WebSocketManagerMiddleware>(handler)));
 }