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