Documentation ¶
Index ¶
- Constants
- func GetBarrageServerAndLiveState(room string) (string, string, error)
- func GetRoomId(uri string) (string, error)
- func RandUser() int
- type Client
- type Handler
- type HandlerRegister
- func (hr *HandlerRegister) Add(key string, h Handler, name string) error
- func (hr *HandlerRegister) DisableByName(name string) error
- func (hr *HandlerRegister) DisableByType(key string) error
- func (hr *HandlerRegister) Dump() string
- func (hr *HandlerRegister) EnableByName(name string) error
- func (hr *HandlerRegister) EnableByType(key string) error
- func (hr *HandlerRegister) Get(key string) (error, []*HandlerWrapper)
- type HandlerWrapper
- type Message
Constants ¶
View Source
const ( HEADER_LENGTH = 16 // in bytes DEVICE_TYPE = 1 DEVICE = 1 )
View Source
const ( // cmd types DANMU_MSG = "DANMU_MSG" // SERVER_PORT = "2243" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct { HandlerRegister *HandlerRegister // contains filtered or unexported fields }
type HandlerRegister ¶
type HandlerRegister struct {
// contains filtered or unexported fields
}
HandlerRegister: message handler manager
func CreateHandlerRegister ¶
func CreateHandlerRegister() *HandlerRegister
CreateHandlerRegister: create handler register
func (*HandlerRegister) Add ¶
func (hr *HandlerRegister) Add(key string, h Handler, name string) error
Add: add message callback handle to handler register
func (*HandlerRegister) DisableByName ¶
func (hr *HandlerRegister) DisableByName(name string) error
DisableByName: disable message handler by name
func (*HandlerRegister) DisableByType ¶
func (hr *HandlerRegister) DisableByType(key string) error
DisableByType: disable handler by message type
func (*HandlerRegister) Dump ¶
func (hr *HandlerRegister) Dump() string
Dump: output all message handlers
func (*HandlerRegister) EnableByName ¶
func (hr *HandlerRegister) EnableByName(name string) error
EnableByName: enable message handler by name
func (*HandlerRegister) EnableByType ¶
func (hr *HandlerRegister) EnableByType(key string) error
EnableByType: enable handler by message type
func (*HandlerRegister) Get ¶
func (hr *HandlerRegister) Get(key string) (error, []*HandlerWrapper)
Get: get message handler
type HandlerWrapper ¶
type HandlerWrapper struct {
// contains filtered or unexported fields
}
HandlerWrapper: message handler wrapper
func (*HandlerWrapper) Run ¶
func (s *HandlerWrapper) Run(msg *Message)
Run: message handler callback
type Message ¶
type Message struct {
// contains filtered or unexported fields
}
func NewHandshakeMessage ¶
func NewHeartbeatMessage ¶
func NewMessage ¶
Click to show internal directories.
Click to hide internal directories.