Documentation ¶
Overview ¶
Package room implements an abstraction for a basic room system. Rooms can be checked in to and checkd out of by users
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Opts ¶
type Opts struct { // Prefix can be used if you wish to have two separate room systems being // persisted on the same Cmder. Prefix will be part of a string prepended to // all key names Prefix string // CheckInPeriod indicates how long a user has to check in to a room before // they are recorded as not being in it anymore. It should not be set to // less than 1 second. Defaults to 30 seconds CheckInPeriod time.Duration }
Opts are different options which may be passed into New when creating a system. They all have sane defaults which will cover most use cases
type System ¶
type System struct {
// contains filtered or unexported fields
}
System holds on to a Cmder and uses it to implement a basic room system
func New ¶
New returns a new System which will use the given Cmder as its persistence layer. The passed in Opts may be used to modify behavior of the System, or may be nil to just use the defaults
func (*System) Cardinality ¶
Cardinality returns the number of user ids currently checked into a room
func (*System) CheckIn ¶
CheckIn records that a user with the given id has joined the given room. The user must check in periodically (see the CheckInPeriod field of System) or they will be recorded as not in the room anymore
func (*System) Key ¶
Key returns a key which can be used to interact with some arbitrary room data directly in redis. This is useful if more complicated, lower level operations are needed to be done
Directories ¶
Path | Synopsis |
---|---|
Package broadcast implements a generic system where a user can generate content which can then be consumed by multiple other users.
|
Package broadcast implements a generic system where a user can generate content which can then be consumed by multiple other users. |