Documentation ¶
Index ¶
- Variables
- type Builder
- type Client
- func (c *Client) ForceClose(err error)
- func (c *Client) Next() uint32
- func (c *Client) Receive() (methodName uint16, messageId uint32, data []byte, err error)
- func (c *Client) Send(methodName uint16, req proto.Message) (err error)
- func (c *Client) SendWithReply(methodName uint16, req proto.Message) (replyPacket *ReplyPacket, err error)
- type CommonResponse
- type Options
- type ReplyPacket
- type Server
- func (s *Server) OnBoot(eng gnet.Engine) (action gnet.Action)
- func (s *Server) OnClose(c gnet.Conn, err error) (action gnet.Action)
- func (s *Server) OnOpen(c gnet.Conn) (out []byte, action gnet.Action)
- func (s *Server) OnReceive(handler transport.ReceiveHandler)
- func (s *Server) OnTraffic(c gnet.Conn) (action gnet.Action)
- func (s *Server) Start()
- func (s *Server) Stop()
- type SimpleCodec
- type WriteChPacket
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrIncompletePacket = errors.New("incomplete packet")
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
func NewBuilder ¶
func NewBuilder() *Builder
func (*Builder) OnClientDisconnected ¶
type Client ¶
type Client struct { Connected bool Target string DisconnectHandler transport.DisconnectHandler // contains filtered or unexported fields }
func (*Client) ForceClose ¶
func (*Client) SendWithReply ¶
type CommonResponse ¶
type ReplyPacket ¶
type Server ¶
type Server struct { gnet.BuiltinEventEngine // contains filtered or unexported fields }
func (*Server) OnReceive ¶
func (s *Server) OnReceive(handler transport.ReceiveHandler)
OnReceive 监听接收到消息
type SimpleCodec ¶
type SimpleCodec struct{}
SimpleCodec Protocol format:
* 0 4 * +-----------+-----------------------+ * | body len | * | methodName | * | message id | * +-----------+-----------+-----------+ * | | * + + * | body bytes | * + + * | ... ... | * +-----------------------------------+
func (*SimpleCodec) Decode ¶
func (codec *SimpleCodec) Decode(c gnet.Conn) (*CommonResponse, error)
type WriteChPacket ¶
type WriteChPacket struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.