Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrAcount = errors.New("err account")
View Source
var ErrClosed = errors.New("conn is closed")
View Source
var ErrLogined = errors.New("account is logined")
View Source
var ErrNotLogin = errors.New("not logined")
Functions ¶
func GenHandler ¶
func GenHandler(h Handler) reqHandler
Types ¶
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
Connection wrap web socket
type Heartbeat ¶
type Heartbeat struct{}
func (*Heartbeat) Handle ¶
func (h *Heartbeat) Handle(c *Connection) error
func (*Heartbeat) Marshal ¶
func (h *Heartbeat) Marshal() json.RawMessage
type LoginReq ¶
type LoginReq struct {
Account string `json:"account"`
}
func (*LoginReq) Handle ¶
func (req *LoginReq) Handle(c *Connection) error
type LogoutReq ¶
type LogoutReq struct {
Account string `json:"account"`
}
func (*LogoutReq) Handle ¶
func (req *LogoutReq) Handle(c *Connection) error
type Request ¶
type Request struct { Type string `json:"type"` Data json.RawMessage `json:"data"` }
type SubscribeReq ¶
type SubscribeReq struct {
Topics []string `json:"topics"`
}
func (*SubscribeReq) Handle ¶
func (req *SubscribeReq) Handle(c *Connection) error
func (*SubscribeReq) Type ¶
func (req *SubscribeReq) Type() string
type UnsubscribeReq ¶
type UnsubscribeReq struct {
Topics []string `json:"topics"`
}
func (*UnsubscribeReq) Handle ¶
func (req *UnsubscribeReq) Handle(c *Connection) error
func (*UnsubscribeReq) Type ¶
func (req *UnsubscribeReq) Type() string
Click to show internal directories.
Click to hide internal directories.