Files
ROLAC/API/ROLAC.API/Hubs/OfferingEntryHub.cs
T
2026-06-20 20:42:06 -07:00

22 lines
877 B
C#

using Microsoft.AspNetCore.SignalR;
namespace ROLAC.API.Hubs;
/// <summary>
/// Real-time hub backing the mobile Sunday offering-entry page. Anonymous
/// (no [Authorize]) so volunteers can enter givings on their phones without
/// logging in. Clients join a group named after the session date (yyyy-MM-dd);
/// when a line is appended, the controller broadcasts "LineAdded" to that
/// group so every phone and the desktop Sunday Offering Entry page updating
/// the same date see the new line instantly. The hub itself holds no business
/// logic — broadcasting is done from the controller via IHubContext.
/// </summary>
public class OfferingEntryHub : Hub
{
public Task JoinDate(string date)
=> Groups.AddToGroupAsync(Context.ConnectionId, date);
public Task LeaveDate(string date)
=> Groups.RemoveFromGroupAsync(Context.ConnectionId, date);
}