Is there a way to access the hub routing table after it's been configured?
@zanate4019 what's the scenario where you need to do so?
The main reason is because I'd like to drop the urls in javascript variables in my mvc template using razor. This will allow my front-end SPA to always know the address of my SignalR endpoints even if the routing changes and only have to configure it in one place (startup.cs).
Here's some psuedo code for what I'm talking about:
`
var bwf = (() => {
return {
userUrl: '@Url.Action("Index", "User", null)',
pagingUrl: '@Url.Action("Index", "Paging", null)',
dataminingUrl: '@Url.Action("Index", "Datamining", null)',
reportingUrl: '@Url.Action("Index", "Reporting", null)',
examUpdateUrl: '@Url.Hub("ExamHub")', // Url to the Exam Hub endpoint
userUpdateUrl: '@Url.Hub("UserHub")', // Url to the User Hub endpoint
workItemUpdateUrl: '@Url.Hub("WorkItemHub")', // Url to the Work Item endpoint
};
})();
</script>
`
@bradygaster @BrennanConroy please respond
PS -- I can (probably) write the extension method to add it to the Url helper, but what I need to know is how access the routing table for signalr after it's configured.
Couldn't you do this by making a variable for the route and using it in startup.cs and the razor file?
question to @glennc - would endpoint routing support the Hub URLs? I ask as, maybe it's possible that could help in this scenario. If users could use endpoint routing to generate the correct URL as a string, it could then be pumped into the HTML as a variable or model property.
@BrennanConroy I could, but it wouldn't really buy anything. I need the absolute Urls because I'm consuming it with Angular and the relative Uri's get mis-interpreted. There are number of factors that go into format of the Url and would like to it be dynamic as possible so I'm only configuring it in one place.
@bradygaster I was just reading about Endpoint routing today when I saw the release notes for 2.2 and thought the same thing.