Class PresenceTracker
public class PresenceTracker
- Inheritance
-
PresenceTracker
- Inherited Members
Constructors
PresenceTracker()
public PresenceTracker()
Methods
ForceRemoveUser(string)
Forcibly remove a user from all tracking. Returns their connection IDs and channels so the caller can broadcast departures and force-disconnect connections.
public (List<string> ConnectionIds, List<string> Channels) ForceRemoveUser(string username)
Parameters
usernamestring
Returns
- (List<string> ConnectionIds, List<string> Channels)
GetChannelsForUser(string)
public List<string> GetChannelsForUser(string username)
Parameters
usernamestring
Returns
- List<string>
GetConnectionsInChannels(List<string>)
Get all unique connection IDs for users who share any of the given channels.
public List<string> GetConnectionsInChannels(List<string> channels)
Parameters
channelsList<string>
Returns
- List<string>
GetOnlineUserCount()
public int GetOnlineUserCount()
Returns
GetOnlineUsersInChannel(string)
public List<string> GetOnlineUsersInChannel(string channelName)
Parameters
channelNamestring
Returns
- List<string>
GetUsernameForConnection(string)
public string? GetUsernameForConnection(string connectionId)
Parameters
connectionIdstring
Returns
IsOnline(string)
public bool IsOnline(string username)
Parameters
usernamestring
Returns
JoinChannel(string, string)
Returns true if this is a new join, false if the user was already in the channel.
public bool JoinChannel(string username, string channelName)
Parameters
Returns
LeaveChannel(string, string)
public void LeaveChannel(string username, string channelName)
Parameters
UserConnected(string, Guid, string)
public void UserConnected(string connectionId, Guid userId, string username)
Parameters
UserDisconnected(string)
public string? UserDisconnected(string connectionId)
Parameters
connectionIdstring
Returns
Events
UserCountChanged
Raised when the distinct online user count changes (multi-connection users only fire once).
public event Action<int>? UserCountChanged