Reputation: 8337
I am curious as to how SignalR maps a request to the Hub?
How does it select which Hub to use? Where is the name of the hub in the request?
Additionally, how does it select which action in the hub gets to handle the request? Is that part of the request url?
And finally is there a way to tap into this pipeline (eg. an IActionFilter, IHubSelector, IActionSelector)?
Upvotes: 0
Views: 455
Reputation: 8337
It gets the types of the hubs via:
IAssemblyLocator
, which returns the relevant assemblies.
SignalR than interrogates the assemblies for all types that passes:
private static bool IsHubType(Type type)
{
try
{
return typeof (IHub).IsAssignableFrom(type) && !type.IsAbstract
&& (type.Attributes.HasFlag((Enum) TypeAttributes.Public)
|| type.Attributes.HasFlag((Enum) TypeAttributes.NestedPublic));
}
catch
{
return false;
}
}
The types that pass the condition above are then used to create IHubDescriptors
, whose type property are then resolved via the dependency resolver.
Upvotes: 2
Reputation: 38784
SignalR is open source. You can find most of what you are looking for here: https://github.com/SignalR/SignalR/tree/master/src/Microsoft.AspNet.SignalR.Core/Hubs
Start from this line for the incoming channel:
Good luck!
Upvotes: 2