| 1234567891011121314151617181920212223 |
- namespace Application.Abstractions.Hub;
- /// <summary>
- /// SignalR AppHub 접속자 추적 (Redis 기반).
- /// 한 멤버가 여러 탭/디바이스 접속 가능 → connectionId refcount 패턴.
- /// </summary>
- public interface IPresenceTracker
- {
- /// <summary>새 SignalR connection 등록. 첫 connection이면 online set에 추가. 반환값: true = 0→1 전환(첫 접속).</summary>
- Task<bool> AddConnectionAsync(int memberID, string connectionId);
- /// <summary>SignalR disconnect 처리. 마지막 connection이면 online set에서 제거. 반환값: true = 1→0 전환(완전 종료).</summary>
- Task<bool> RemoveConnectionAsync(int memberID, string connectionId);
- /// <summary>특정 멤버 온라인 여부.</summary>
- Task<bool> IsOnlineAsync(int memberID);
- /// <summary>여러 멤버의 온라인 ID 집합 일괄 조회.</summary>
- Task<HashSet<int>> GetOnlineMembersAsync(IEnumerable<int> memberIDs);
- /// <summary>Web.Api 시작 시 stale presence 데이터(고아 connectionId, online set) 일괄 정리. 모든 SignalR 클라이언트는 재연결 시 OnConnected로 재등록됨.</summary>
- Task ClearAllAsync();
- }
|