Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CallBackToClient ¶
============== 定义当前客户端链接的handle api ===========
Types ¶
type BaseRouter ¶
type BaseRouter struct{}
func (*BaseRouter) Handle ¶
func (br *BaseRouter) Handle(req ziface.IRequest)
这里之所以BaseRouter的方法都为空, 是因为有的Router不希望有PreHandle或PostHandle 所以Router全部继承BaseRouter的好处是,不需要实现PreHandle和PostHandle也可以实例化
type Connection ¶
type Connection struct { //当前连接的socket TCP套接字 Conn *net.TCPConn //当前连接的ID 也可以称作为SessionID,ID全局唯一 ConnID uint32 //消息管理MsgId和对应处理方法的消息管理模块 MsgHandler ziface.IMsgHandle //告知该链接已经退出/停止的channel ExitBuffChan chan bool // contains filtered or unexported fields }
func NewConntion ¶
func NewConntion(conn *net.TCPConn, connID uint32, msgHandler ziface.IMsgHandle) *Connection
创建连接的方法
func (*Connection) GetTCPConnection ¶
func (c *Connection) GetTCPConnection() *net.TCPConn
从当前连接获取原始的socket TCPConn
type MsgHandle ¶
func NewMsgHandle ¶
func NewMsgHandle() *MsgHandle
func (*MsgHandle) DoMsgHandler ¶
马上以非阻塞方式处理消息
Click to show internal directories.
Click to hide internal directories.