PresenceTracker class
Client-side presence tracker
Tracks the online/offline status of contacts by subscribing to server-scoped GossipSub presence topics.
Constructors
- PresenceTracker({required PubSub pubsub, required PeerId localPeerId, PresenceCache? cache})
- PresenceTracker.withSubscriber(Subscription subscribe(String topic), {required PeerId localPeerId, PresenceCache? cache})
-
A tracker fed by
subscribeinstead of a live pubsub, for tests.
Properties
- cache → PresenceCache
-
final
-
contactPresenceChanges
→ Stream<
PresenceChange> -
Stream of presence changes for tracked contacts
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- localPeerId → PeerId
-
final
- pubsub → PubSub?
-
final
- rejectedMessages → int
-
Messages refused for not being the server's own.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
trackedContacts
→ Set<
String> -
Get all tracked contacts
no setter
Methods
-
dispose(
) → Future< void> - Stop all tracking and clean up
-
getPresence(
PeerId contact) → PresenceStatus? - Get the current presence state of a contact (from cache)
-
getStats(
) → Map< String, dynamic> - Get tracker statistics
-
handleMessage(
PeerId from, String serverStr, List< int> data) → void -
Applies a presence message signed by
fromthat arrived on the topic of the serverserverStr. -
isOnline(
PeerId contact) → bool - Check if a contact is online
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
trackContact(
PeerId contact, PeerId serverPeerId) → void - Start tracking a contact's presence
-
untrackContact(
PeerId contact) → void - Stop tracking a contact's presence
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited