pyphoenix.presence
Presence tracking implementation for PyPhoenix.
Functions
Get or create the global Presence instance. |
Classes
|
Distributed presence tracking system. |
- class pyphoenix.presence.Presence[source]
Distributed presence tracking system.
Tracks which processes/users are present on which topics across the system. This is a local implementation that will later be extended for distribution.
- async list(topic)[source]
List all presences for a topic.
- Parameters:
topic (
str) – The topic to list presences for- Return type:
- Returns:
Dictionary mapping process IDs to their presence states
- async get_presence(pid, topic)[source]
Get presence state for a specific process on a topic.
- Parameters:
- Return type:
- Returns:
PresenceState if present, None otherwise
- async sync_presence_state(topic)[source]
Get the current presence state for synchronization.
This method returns the full presence state in a format suitable for sending to new joiners or for synchronization between nodes.
- async topic_count()[source]
Get the number of topics with active presences.
- Return type:
- Returns:
Number of topics
- async total_presence_count()[source]
Get the total number of presences across all topics.
- Return type:
- Returns:
Total presence count