Documentation ¶
Index ¶
- type Agent
- type Conn
- type ConnSet
- type MsgParser
- type Processor
- type TCPClient
- type TCPConn
- func (tcpConn *TCPConn) Close()
- func (tcpConn *TCPConn) Destroy()
- func (tcpConn *TCPConn) LocalAddr() net.Addr
- func (tcpConn *TCPConn) Read(b []byte) (int, error)
- func (tcpConn *TCPConn) ReadMsg() ([]byte, error)
- func (tcpConn *TCPConn) RemoteAddr() net.Addr
- func (tcpConn *TCPConn) Write(b []byte)
- func (tcpConn *TCPConn) WriteMsg(args ...[]byte) error
- type TCPServer
- type WSClient
- type WSConn
- type WSHandler
- type WSServer
- type WebsocketConnSet
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Conn ¶
type Conn interface { // 读取消息 ReadMsg() ([]byte, error) // 发送消息 WriteMsg(args ...[]byte) error // 本地地址 LocalAddr() net.Addr // 客户端地址 RemoteAddr() net.Addr // 关闭链接,等待发送队列为空后断开链接 Close() // 关闭链接,立即断开 Destroy() }
网络链接对象接口
type MsgParser ¶
type MsgParser struct {
// contains filtered or unexported fields
}
-------------- | len | data | --------------
func NewMsgParser ¶
func NewMsgParser() *MsgParser
func (*MsgParser) SetByteOrder ¶
It's dangerous to call the method on reading or writing
type Processor ¶
type Processor interface { // must goroutine safe Route(msg interface{}, userData interface{}) error // must goroutine safe Unmarshal(data []byte) (interface{}, error) // must goroutine safe Marshal(msg interface{}) ([][]byte, error) }
消息处理器接口 1.消息注册 2.设置消息处理方法 3.设置消息处理服务端 4.消息序列化反序列化
type TCPClient ¶
type TCPConn ¶
func (*TCPConn) Close ¶
func (tcpConn *TCPConn) Close()
主动关闭连接 立即停止消息发送 发送队列中的未发送的数据会继续发送,直到队列为空,然后连接关闭,发送协程结束
func (*TCPConn) RemoteAddr ¶
type TCPServer ¶
type WSClient ¶
type WSConn ¶
func (*WSConn) RemoteAddr ¶
type WSServer ¶
type WebsocketConnSet ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.