Redeon.SuperSiteEngineCore.Web.Eltheon.Core.Features.Notifications
Overview
This feature packages a lightweight notification bus that allows Eltheon hosts, templates, and plugins to publish operational events without coupling to specific UI implementations. Notifications can be routed to any number of sinks; the default sink provided by the package forwards messages to the existing Admin/User/Public SignalR hubs so web clients receive them instantly.
Building Blocks
NotificationMessage,NotificationScope, andNotificationSeveritydefine the shared payload contract.INotificationPublisheroffers a DI friendly abstraction for emitting messages.NotificationBusfan-outs each published message to every registeredINotificationSink.NotificationSignalRDispatcherimplements a sink that pushes notifications into the Admin/User/Public hubs viaReceiveNotification.AddEltheonNotifications()registers the bus, whileAddNotificationSignalRBridge()wires up the SignalR sink.
Usage
builder.Services
.AddEltheonNotifications()
.AddNotificationSignalRBridge();
public class ExampleService
{
private readonly INotificationPublisher _publisher;
public ExampleService(INotificationPublisher publisher) => _publisher = publisher;
public Task NotifyAsync() =>
_publisher.PublishAsync(NotificationMessage.Create(
title: "Deployment",
message: "A new build is live.",
scope: NotificationScope.Admin | NotificationScope.User,
severity: NotificationSeverity.Success));
}
On the client side, listen to the ReceiveNotification SignalR event (or the eltheon:notification DOM event used by the template) and render toast/snackbar components as needed.
Notes
- The bus is synchronous per sink but awaits asynchronous work inside each sink.
- Register your own sinks (e.g., persistence, queueing, external webhooks) by implementing
INotificationSink. - The SignalR sink depends on the SignalR feature package being added to the host. The extension does not register hubs automatically.