public void Start() { // Get a list of all registered hubs var hubTypes = _dataSource.Endpoints.Select(e => e.Metadata.GetMetadata <HubMetadata>()?.HubType) .Where(hubType => hubType != null) .Distinct() .ToList(); // Make late bound version of the hub dispatcher var dispatcher = new ServiceHubDispatcher(_serviceProvider); foreach (var hubType in hubTypes) { // Start the application for each of the hub types var app = new ConnectionBuilder(_serviceProvider) .UseHub(hubType) .Build(); dispatcher.Start(hubType, app); } }
public void Start() { var dispatcher = new ServiceHubDispatcher(_serviceProvider); foreach (var endpoint in _dataSource.Endpoints) { var hubMetadata = endpoint.Metadata.GetMetadata <HubMetadata>(); var negotiateMetadata = endpoint.Metadata.GetMetadata <NegotiateMetadata>(); // Skip if not a hub or is negotiate endpoint if(hubMetadata == null || negotiateMetadata != null) { continue; } // Start the application for each of the hub types var app = new ConnectionBuilder(_serviceProvider) .UseHub(hubMetadata.HubType) .Build(); // Flow the endpoint to the dispatcher so it can be set on the HttpContextFeature. dispatcher.Start(endpoint, hubMetadata.HubType, app); } }