Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Broadcast ¶
type Broadcast struct {
// contains filtered or unexported fields
}
Broadcast maintains the set of active clients and broadcasts messages to the clients.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a middleman between the websocket connection and the hub.
type DispatchFunc ¶
type Logger ¶
type Logger interface { Info(logs ...interface{}) Warn(logs ...interface{}) Debug(logs ...interface{}) Error(logs ...interface{}) }
type Option ¶
type Option func(d *Hub)
func WithConcurrent ¶
func WithLogger ¶
func WithReceive ¶
func WithReceive(f DispatchFunc) Option
type Redis ¶
type Redis interface { ZAdd(key string, members ...redis.Z) *redis.IntCmd Get(key string) *redis.StringCmd Set(key string, value interface{}, expiration time.Duration) *redis.StatusCmd ZRange(key string, start, stop int64) *redis.StringSliceCmd ZRem(key string, members ...interface{}) *redis.IntCmd ZCard(key string) *redis.IntCmd ZRemRangeByRank(key string, start, stop int64) *redis.IntCmd MGet(keys ...string) *redis.SliceCmd Pipeline() redis.Pipeliner }
type RedisClient ¶
func NewRedisCache ¶
func NewRedisCache(maxCount, maxTtl int, redis Redis) *RedisClient
Click to show internal directories.
Click to hide internal directories.