Adding a hub with SignalR and Umbraco
Umbraco ships with signalR installed, find out how to add your own hub(s) to the existing setup
Create a hub and its interface
public interface ITestHubEvents
{
// Define the events the clients can listen to
public Task Pong();
}using Microsoft.AspNetCore.SignalR;
public class TestHub : Hub<ITestHubEvents>
{
// when a client sends us a ping
public async Task Ping()
{
// we trigger the pong event on all clients
await Clients.All.Pong();
}
}Add the routing to the Umbraco Composer
Add the route in appsettings.json file
Test the setup
Last updated
Was this helpful?