Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler interface { ServeConn(conn *Conn) ServeConnClosed(conn *Conn) ServeAction(action string, conn *Conn, packetDecoder *PacketDecoder) }
type Packet ¶
type Packet struct { Header map[string]interface{} `json:"h,omitempty"` Action string `json:"a"` Data interface{} `json:"d,omitempty"` Error *PacketError `json:"e,omitempty"` }
type PacketDecoder ¶
func NewPacketDecoder ¶
func NewPacketDecoder(data []byte) *PacketDecoder
func (*PacketDecoder) ParseAction ¶
func (decoder *PacketDecoder) ParseAction() (string, error)
func (*PacketDecoder) ParseData ¶
func (decoder *PacketDecoder) ParseData(data interface{}) error
type PacketError ¶
type Peer ¶
type Peer struct {
// contains filtered or unexported fields
}
func (*Peer) HandleActionFunc ¶
func (peer *Peer) HandleActionFunc(action string, actionHandler func(conn *Conn, packetDecoder *PacketDecoder))
收到action包处理
func (*Peer) HandleConnClosedFunc ¶
连接关闭处理
Click to show internal directories.
Click to hide internal directories.