public ObservableControllerMiddleware(RequestDelegate next, IActionDescriptorCollectionProvider routes, TController controller, WebSockets.WebSocketManager webSocketCollection)
        {
            _next                = next;
            _controller          = controller;
            _webSocketCollection = webSocketCollection;
            _routesController    = routes.ActionDescriptors.Items
                                   .Where(x => x.DisplayName.StartsWith(controller.GetType().FullName))
                                   .Select(x => $"/{x.AttributeRouteInfo.Template}").ToList();

            _channel = _routesController.Where(r => r.Contains("GetData")).FirstOrDefault().Replace("GetData", "Subscribe");
            webSocketCollection.Channels.Add(_channel, controller.GetType());
        }
Beispiel #2
0
 public WebSocketHandler(WebSocketManager manager, WebSocket webSocket, string channel)
 {
     _manager   = manager;
     _webSocket = webSocket;
     _id        = new WebSocketKey(channel);
 }