Documentation
¶
Index ¶
- func Initial(ctx context.Context)
- func NewRedisExchange(cfg Config) (*redisExchange, error)
- func StopExchange()
- type Config
- type Exchanger
- type LocalExchange
- func (exc *LocalExchange) Close()
- func (exc *LocalExchange) CreateRoom(receiveChan chan<- model.RoomMessage, roomId string) Room
- func (exc *LocalExchange) DestroyRoom(exRoom Room)
- func (exc *LocalExchange) JoinRoom(receiveChan chan<- model.RoomMessage, roomId string) (Room, error)
- func (exc *LocalExchange) LeaveRoom(exRoom Room, roomId string)
- type Room
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewRedisExchange ¶
func StopExchange ¶
func StopExchange()
Types ¶
type Config ¶
type Config struct { // Defaults to "tcp". Network string // Addr of a single redis server instance. // See "Clusters" field for clusters support. // Defaults to "127.0.0.1:6379". Addr string // Clusters a list of network addresses for clusters. // If not empty "Addr" is ignored. Clusters []string Password string DialTimeout time.Duration // MaxActive defines the size connection pool. // Defaults to 10. MaxActive int DBIndex uint64 }
type Exchanger ¶
type Exchanger interface { CreateRoom(receiveChan chan<- model.RoomMessage, roomId string) Room DestroyRoom(Room) JoinRoom(receiveChan chan<- model.RoomMessage, roomId string) (Room, error) LeaveRoom(sub Room, roomId string) Close() }
func GetExchange ¶
func GetExchange() Exchanger
type LocalExchange ¶
type LocalExchange struct {
// contains filtered or unexported fields
}
func NewLocalExchange ¶
func NewLocalExchange() (*LocalExchange, error)
func (*LocalExchange) Close ¶
func (exc *LocalExchange) Close()
func (*LocalExchange) CreateRoom ¶
func (exc *LocalExchange) CreateRoom(receiveChan chan<- model.RoomMessage, roomId string) Room
func (*LocalExchange) DestroyRoom ¶
func (exc *LocalExchange) DestroyRoom(exRoom Room)
func (*LocalExchange) JoinRoom ¶
func (exc *LocalExchange) JoinRoom(receiveChan chan<- model.RoomMessage, roomId string) (Room, error)
func (*LocalExchange) LeaveRoom ¶
func (exc *LocalExchange) LeaveRoom(exRoom Room, roomId string)
type Room ¶
type Room interface {
Publish(msg model.RoomMessage)
}
Click to show internal directories.
Click to hide internal directories.