Last updated
Was this helpful?
Last updated
Was this helpful?
Umbraco ships with signalR installed. This article shows how to add your own hub(s) to the existing setup.
We are going to go for the most basic implementation possible, a status ping. So first create a new interface with the following code:
And then the actual hub:
Next up, is defining a custom route. Use IAreaRoutes
and the base Umbraco backend path so there's no need to reserve another path in the settings.
Last step in the setup is registering our custom route:
When setting up SignalR routes, add the route to ReservedPaths
in the appsettings.json
file like:
And lastly we can test the setup with some JavaScript in our view:
When you insert this in a view, you should see a signalR connection established
console message followed by Pong
.
You need to provide the default reserved paths, else you'll run into an issue as mentioned on .
Umbraco ships with signalR installed, find out how to add your own hub(s) to the existing setup