| 1 |
package centrifuge |
| 2 |
|
| 3 |
// PresenceStats represents a short presence information for channel. |
| 4 |
type PresenceStats struct { |
| 5 |
// NumClients is a number of client connections in channel. |
| 6 |
NumClients int |
| 7 |
// NumUsers is a number of unique users in channel. |
| 8 |
NumUsers int |
| 9 |
} |
| 10 |
|
| 11 |
// PresenceManager is responsible for channel presence management. |
| 12 |
type PresenceManager interface { |
| 13 |
// Presence returns actual presence information for channel. |
| 14 |
Presence(ch string) (map[string]*ClientInfo, error) |
| 15 |
// PresenceStats returns short stats of current presence data |
| 16 |
// suitable for scenarios when caller does not need full client |
| 17 |
// info returned by presence method. |
| 18 |
PresenceStats(ch string) (PresenceStats, error) |
| 19 |
// AddPresence sets or updates presence information in channel |
| 20 |
// for connection with specified identifier. PresenceManager should |
| 21 |
// have a property to expire client information that was not updated |
| 22 |
// (touched) after some configured time interval. |
| 23 |
AddPresence(ch string, clientID string, info *ClientInfo) error |
| 24 |
// RemovePresence removes presence information for connection |
| 25 |
// with specified identifier. |
| 26 |
RemovePresence(ch string, clientID string) error |
| 27 |
} |