using Microsoft.AspNetCore.SignalR; namespace ControlCenter.Api.Hubs; /// /// SignalR hub for broadcasting agent status updates to connected clients. /// /// /// Clients connect to this hub at the /hub endpoint to receive /// real-time agent state changes. A background service subscribes to /// OpenClaw Gateway events and pushes them through this hub. /// /// /// /// Architecture note: This hub bridges OpenClaw Gateway events to SignalR clients. /// The full typed client interface and extension methods will be added in a /// subsequent task (CUB-55). /// /// public class AgentStatusHub : Hub { private readonly ILogger _logger; /// /// Initializes a new instance of the class. /// /// Logger for diagnostic output. public AgentStatusHub(ILogger logger) { _logger = logger; } /// /// Overrides to log new connections. /// public override Task OnConnectedAsync() { _logger.LogDebug("Client connected: {ConnectionId}", Context.ConnectionId); return base.OnConnectedAsync(); } /// /// Overrides to log disconnections. /// SignalR automatically removes disconnected connections from all groups. /// /// Exception that caused the disconnection, if any. public override Task OnDisconnectedAsync(Exception? exception) { _logger.LogDebug("Client disconnected: {ConnectionId}", Context.ConnectionId); return base.OnDisconnectedAsync(exception); } }