You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nnet/entity/network.go

25 lines
674 B
Go

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

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
}