feat(dashboard): in-process session event subscription feeds the viewer registry — SessionDetailsPage drops its /hubs/events hop

This commit is contained in:
Joseph Doherty
2026-08-15 20:15:52 -04:00
parent d44fe1d6b5
commit e23f816bfb
5 changed files with 501 additions and 58 deletions
@@ -0,0 +1,26 @@
using System.Threading.Channels;
using ZB.MOM.WW.MxGateway.Contracts.Proto;
namespace ZB.MOM.WW.MxGateway.Server.Dashboard.Hubs;
/// <summary>
/// A live in-process feed of one session's dashboard-mirrored MxEvents, handed
/// out by <see cref="IDashboardSessionEventSubscriber.Subscribe"/>. Server-side
/// Blazor components read it directly instead of looping back through
/// <see cref="EventsHub"/> over a loopback SignalR connection.
/// </summary>
/// <remarks>
/// Events are delivered exactly as a hub client would see them — the same
/// redacted clone the group send carries, so <c>MxGateway:Dashboard:ShowTagValues</c>
/// governs both paths identically. The feed is a bounded, lossy queue: a
/// consumer that falls behind loses the oldest queued events, matching the
/// best-effort contract the SignalR mirror already has. Disposing the
/// subscription deregisters it, which is what lets the broadcaster go back to
/// skipping all mirror work for a session nobody is watching — so callers must
/// dispose. Dispose is idempotent.
/// </remarks>
public interface IDashboardEventSubscription : IDisposable
{
/// <summary>Gets the reader delivering this session's mirrored events.</summary>
ChannelReader<MxEvent> Reader { get; }
}