package entity import "net" type NetworkEntity interface { // Send 主动发送消息,支持自定义header,payload Send(header, payload interface{}) error // SendBytes 主动发送消息,消息需提前编码 SendBytes(data []byte) error // Status 获取当前连接状态 Status() int32 // SetStatus 设置当前连接状态 SetStatus(s int32) // Conn 获取当前底层连接(还需根据返回参数2决定是否转换为WSConn) Conn() (net.Conn, bool) // Session 获取当前连接 Session Session() Session // LastMID 最新消息ID LastMID() uint64 // SetLastMID 设置消息ID SetLastMID(mid uint64) // Close 关闭连接 Close() error }