-
Notifications
You must be signed in to change notification settings - Fork 1
SignalR
IOF edited this page Jul 23, 2025
·
1 revision
builder.Services.AddSignalR();
app.MapHub<HealthCheckHub>("/api/health-hub");public class HealthCheckHub : Hub
{
}[ApiController]
[Route("api/[controller]/[action]")]
public class BroadcastController : ControllerBase
{
private IHubContext<HealthCheckHub> _hub;
public BroadcastController(
IHubContext<HealthCheckHub> hub
)
{
_hub = hub;
}
[HttpGet]
public async Task<IActionResult> Update()
{
await _hub.Clients.All.SendAsync("Update", "test");
return Ok("Update message sent.");
}
}