Documentation
¶
Overview ¶
服务端Server的链接模块
Index ¶
- Constants
- Variables
- func NewClient(ip string, port int, opts ...ClientOption) ziface.IClient
- func NewHeartbeatChecker(interval time.Duration) ziface.IHeartbeatChecker
- func NewServer(opts ...Option) ziface.IServer
- func NewUserConfServer(config *zconf.Config, opts ...Option) ziface.IServer
- func NewWsClient(ip string, port int, opts ...ClientOption) ziface.IClient
- type BaseRouter
- type Client
- func (c *Client) AddInterceptor(interceptor ziface.IInterceptor)
- func (c *Client) AddRouter(msgID uint32, router ziface.IRouter)
- func (c *Client) Conn() ziface.IConnection
- func (c *Client) GetLengthField() *ziface.LengthField
- func (c *Client) GetMsgHandler() ziface.IMsgHandle
- func (c *Client) GetOnConnStart() func(ziface.IConnection)
- func (c *Client) GetOnConnStop() func(ziface.IConnection)
- func (c *Client) GetPacket() ziface.IDataPack
- func (c *Client) SetDecoder(decoder ziface.IDecoder)
- func (c *Client) SetOnConnStart(hookFunc func(ziface.IConnection))
- func (c *Client) SetOnConnStop(hookFunc func(ziface.IConnection))
- func (c *Client) SetPacket(packet ziface.IDataPack)
- func (c *Client) Start()
- func (c *Client) StartHeartBeat(interval time.Duration)
- func (c *Client) StartHeartBeatWithOption(interval time.Duration, option *ziface.HeartBeatOption)
- func (c *Client) Stop()
- type ClientOption
- type ConnManager
- func (connMgr *ConnManager) Add(conn ziface.IConnection)
- func (connMgr *ConnManager) ClearConn()
- func (connMgr *ConnManager) Get(connID uint64) (ziface.IConnection, error)
- func (connMgr *ConnManager) GetAllConnID() []uint64
- func (connMgr *ConnManager) Len() int
- func (connMgr *ConnManager) Range(cb func(uint64, ziface.IConnection, interface{}) error, args interface{}) (err error)
- func (connMgr *ConnManager) Remove(conn ziface.IConnection)
- type Connection
- func (c *Connection) Context() context.Context
- func (c *Connection) GetConnID() uint64
- func (c *Connection) GetConnection() net.Conn
- func (c *Connection) GetProperty(key string) (interface{}, error)
- func (c *Connection) GetTCPConnection() net.Conndeprecated
- func (c *Connection) GetWsConn() *websocket.Conn
- func (c *Connection) IsAlive() bool
- func (c *Connection) LocalAddr() net.Addr
- func (c *Connection) RemoteAddr() net.Addr
- func (c *Connection) RemoveProperty(key string)
- func (c *Connection) Send(data []byte) error
- func (c *Connection) SendBuffMsg(msgID uint32, data []byte) error
- func (c *Connection) SendMsg(msgID uint32, data []byte) error
- func (c *Connection) SendToQueue(data []byte) error
- func (c *Connection) SetHeartBeat(checker ziface.IHeartbeatChecker)
- func (c *Connection) SetProperty(key string, value interface{})
- func (c *Connection) Start()
- func (c *Connection) StartReader()
- func (c *Connection) StartWriter()
- func (c *Connection) Stop()
- type HeartbeatChecker
- func (h *HeartbeatChecker) BindConn(conn ziface.IConnection)
- func (h *HeartbeatChecker) BindRouter(msgID uint32, router ziface.IRouter)
- func (h *HeartbeatChecker) Clone() ziface.IHeartbeatChecker
- func (h *HeartbeatChecker) MsgID() uint32
- func (h *HeartbeatChecker) Router() ziface.IRouter
- func (h *HeartbeatChecker) SendHeartBeatMsg() error
- func (h *HeartbeatChecker) SetHeartbeatFunc(beatFunc ziface.HeartBeatFunc)
- func (h *HeartbeatChecker) SetHeartbeatMsgFunc(f ziface.HeartBeatMsgFunc)
- func (h *HeartbeatChecker) SetOnRemoteNotAlive(f ziface.OnRemoteNotAlive)
- func (h *HeartbeatChecker) Start()
- func (h *HeartbeatChecker) Stop()
- type HeatBeatDefaultRouter
- type MsgHandle
- func (mh *MsgHandle) AddInterceptor(interceptor ziface.IInterceptor)
- func (mh *MsgHandle) AddRouter(msgID uint32, router ziface.IRouter)
- func (mh *MsgHandle) Execute(request ziface.IRequest)
- func (mh *MsgHandle) Intercept(chain ziface.IChain) ziface.IcResp
- func (mh *MsgHandle) SendMsgToTaskQueue(request ziface.IRequest)
- func (mh *MsgHandle) StartOneWorker(workerID int, taskQueue chan ziface.IRequest)
- func (mh *MsgHandle) StartWorkerPool()
- type Option
- type Request
- func (r *Request) Abort()
- func (r *Request) BindRouter(router ziface.IRouter)
- func (r *Request) Call()
- func (r *Request) GetConnection() ziface.IConnection
- func (r *Request) GetData() []byte
- func (r *Request) GetMessage() ziface.IMessage
- func (r *Request) GetMsgID() uint32
- func (r *Request) GetResponse() ziface.IcResp
- func (r *Request) Goto(step ziface.HandleStep)
- func (r *Request) SetResponse(response ziface.IcResp)
- type Server
- func (s *Server) AddInterceptor(interceptor ziface.IInterceptor)
- func (s *Server) AddRouter(msgID uint32, router ziface.IRouter)
- func (s *Server) GetConnMgr() ziface.IConnManager
- func (s *Server) GetHeartBeat() ziface.IHeartbeatChecker
- func (s *Server) GetLengthField() *ziface.LengthField
- func (s *Server) GetMsgHandler() ziface.IMsgHandle
- func (s *Server) GetOnConnStart() func(ziface.IConnection)
- func (s *Server) GetOnConnStop() func(ziface.IConnection)
- func (s *Server) GetPacket() ziface.IDataPack
- func (s *Server) Serve()
- func (s *Server) SetDecoder(decoder ziface.IDecoder)
- func (s *Server) SetOnConnStart(hookFunc func(ziface.IConnection))
- func (s *Server) SetOnConnStop(hookFunc func(ziface.IConnection))
- func (s *Server) SetPacket(packet ziface.IDataPack)
- func (s *Server) Start()
- func (s *Server) StartHeartBeat(interval time.Duration)
- func (s *Server) StartHeartBeatWithOption(interval time.Duration, option *ziface.HeartBeatOption)
- func (s *Server) Stop()
- type WsClient
- func (c *WsClient) AddInterceptor(interceptor ziface.IInterceptor)
- func (c *WsClient) AddRouter(msgID uint32, router ziface.IRouter)
- func (c *WsClient) Conn() ziface.IConnection
- func (c *WsClient) GetLengthField() *ziface.LengthField
- func (c *WsClient) GetMsgHandler() ziface.IMsgHandle
- func (c *WsClient) GetOnConnStart() func(ziface.IConnection)
- func (c *WsClient) GetOnConnStop() func(ziface.IConnection)
- func (c *WsClient) GetPacket() ziface.IDataPack
- func (c *WsClient) SetDecoder(decoder ziface.IDecoder)
- func (c *WsClient) SetOnConnStart(hookFunc func(ziface.IConnection))
- func (c *WsClient) SetOnConnStop(hookFunc func(ziface.IConnection))
- func (c *WsClient) SetPacket(packet ziface.IDataPack)
- func (c *WsClient) Start()
- func (c *WsClient) StartHeartBeat(interval time.Duration)
- func (c *WsClient) StartHeartBeatWithOption(interval time.Duration, option *ziface.HeartBeatOption)
- func (c *WsClient) Stop()
- type WsConnection
- func (c *WsConnection) Context() context.Context
- func (c *WsConnection) GetConnID() uint64
- func (c *WsConnection) GetConnection() net.Conn
- func (c *WsConnection) GetProperty(key string) (interface{}, error)
- func (c *WsConnection) GetTCPConnection() net.Conndeprecated
- func (c *WsConnection) GetWsConn() *websocket.Conn
- func (c *WsConnection) IsAlive() bool
- func (c *WsConnection) LocalAddr() net.Addr
- func (c *WsConnection) RemoteAddr() net.Addr
- func (c *WsConnection) RemoveProperty(key string)
- func (c *WsConnection) Send(data []byte) error
- func (c *WsConnection) SendBuffMsg(msgID uint32, data []byte) error
- func (c *WsConnection) SendMsg(msgID uint32, data []byte) error
- func (c *WsConnection) SendToQueue(data []byte) error
- func (c *WsConnection) SetHeartBeat(checker ziface.IHeartbeatChecker)
- func (c *WsConnection) SetProperty(key string, value interface{})
- func (c *WsConnection) Start()
- func (c *WsConnection) StartReader()
- func (c *WsConnection) StartWriter()
- func (c *WsConnection) Stop()
Constants ¶
const ( PRE_HANDLE ziface.HandleStep = iota //PreHandle 预处理 HANDLE //Handle 处理 POST_HANDLE //PostHandle 后处理 HANDLE_OVER )
Variables ¶
var AcceptDelay *acceptDelay
Functions ¶
func NewClient ¶ added in v1.1.0
func NewClient(ip string, port int, opts ...ClientOption) ziface.IClient
func NewHeartbeatChecker ¶ added in v1.1.12
func NewHeartbeatChecker(interval time.Duration) ziface.IHeartbeatChecker
NewHeartbeatChecker 创建心跳检测器
func NewUserConfServer ¶ added in v1.0.2
NewServer 创建一个服务器句柄
func NewWsClient ¶ added in v1.1.15
func NewWsClient(ip string, port int, opts ...ClientOption) ziface.IClient
Types ¶
type Client ¶ added in v1.1.0
type Client struct {
//目标链接服务器的IP
Ip string
//目标链接服务器的端口
Port int
// contains filtered or unexported fields
}
func (*Client) AddInterceptor ¶ added in v1.1.1
func (c *Client) AddInterceptor(interceptor ziface.IInterceptor)
func (*Client) Conn ¶ added in v1.1.0
func (c *Client) Conn() ziface.IConnection
func (*Client) GetLengthField ¶ added in v1.1.1
func (c *Client) GetLengthField() *ziface.LengthField
func (*Client) GetMsgHandler ¶ added in v1.1.0
func (c *Client) GetMsgHandler() ziface.IMsgHandle
func (*Client) GetOnConnStart ¶ added in v1.1.0
func (c *Client) GetOnConnStart() func(ziface.IConnection)
GetOnConnStart 得到该Server的连接创建时Hook函数
func (*Client) GetOnConnStop ¶ added in v1.1.0
func (c *Client) GetOnConnStop() func(ziface.IConnection)
得到该Server的连接断开时的Hook函数
func (*Client) SetDecoder ¶ added in v1.1.3
func (*Client) SetOnConnStart ¶ added in v1.1.0
func (c *Client) SetOnConnStart(hookFunc func(ziface.IConnection))
设置该Client的连接创建时Hook函数
func (*Client) SetOnConnStop ¶ added in v1.1.0
func (c *Client) SetOnConnStop(hookFunc func(ziface.IConnection))
设置该Client的连接断开时的Hook函数
func (*Client) StartHeartBeat ¶ added in v1.1.0
StartHeartBeat 启动心跳检测 interval 每次发送心跳的时间间隔
func (*Client) StartHeartBeatWithOption ¶ added in v1.1.0
func (c *Client) StartHeartBeatWithOption(interval time.Duration, option *ziface.HeartBeatOption)
启动心跳检测(自定义回调)
type ClientOption ¶ added in v1.1.0
Client的客户端Option
func WithPacketClient ¶ added in v1.1.0
func WithPacketClient(pack ziface.IDataPack) ClientOption
Client的客户端Option
type ConnManager ¶
type ConnManager struct {
// contains filtered or unexported fields
}
ConnManager 连接管理模块
func (*ConnManager) Get ¶
func (connMgr *ConnManager) Get(connID uint64) (ziface.IConnection, error)
Get 利用ConnID获取链接
func (*ConnManager) GetAllConnID ¶ added in v1.1.0
func (connMgr *ConnManager) GetAllConnID() []uint64
GetAllConnID 获取所有连接的ID
func (*ConnManager) Range ¶ added in v1.1.12
func (connMgr *ConnManager) Range(cb func(uint64, ziface.IConnection, interface{}) error, args interface{}) (err error)
Range 遍历所有连接
func (*ConnManager) Remove ¶
func (connMgr *ConnManager) Remove(conn ziface.IConnection)
Remove 删除连接
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
Connection Tcp连接模块 用于处理Tcp连接的读写业务 一个连接对应一个Connection
func (*Connection) Context ¶ added in v1.0.1
func (c *Connection) Context() context.Context
返回ctx,用于用户自定义的go程获取连接退出状态
func (*Connection) GetConnection ¶ added in v1.1.0
func (c *Connection) GetConnection() net.Conn
func (*Connection) GetProperty ¶
func (c *Connection) GetProperty(key string) (interface{}, error)
GetProperty 获取链接属性
func (*Connection) GetTCPConnection
deprecated
func (c *Connection) GetTCPConnection() net.Conn
Deprecated: use GetConnection instead
func (*Connection) GetWsConn ¶ added in v1.1.15
func (c *Connection) GetWsConn() *websocket.Conn
func (*Connection) IsAlive ¶ added in v1.1.0
func (c *Connection) IsAlive() bool
func (*Connection) LocalAddr ¶ added in v1.1.0
func (c *Connection) LocalAddr() net.Addr
LocalAddr 获取链接本地地址信息
func (*Connection) RemoveProperty ¶
func (c *Connection) RemoveProperty(key string)
RemoveProperty 移除链接属性
func (*Connection) Send ¶ added in v1.1.1
func (c *Connection) Send(data []byte) error
func (*Connection) SendBuffMsg ¶
func (c *Connection) SendBuffMsg(msgID uint32, data []byte) error
SendBuffMsg 发生BuffMsg
func (*Connection) SendMsg ¶
func (c *Connection) SendMsg(msgID uint32, data []byte) error
SendMsg 直接将Message数据发送数据给远程的TCP客户端
func (*Connection) SendToQueue ¶ added in v1.1.1
func (c *Connection) SendToQueue(data []byte) error
func (*Connection) SetHeartBeat ¶ added in v1.1.14
func (c *Connection) SetHeartBeat(checker ziface.IHeartbeatChecker)
func (*Connection) SetProperty ¶
func (c *Connection) SetProperty(key string, value interface{})
SetProperty 设置链接属性
func (*Connection) StartReader ¶
func (c *Connection) StartReader()
StartReader 读消息Goroutine,用于从客户端中读取数据
func (*Connection) StartWriter ¶
func (c *Connection) StartWriter()
StartWriter 写消息Goroutine, 用户将数据发送给客户端
type HeartbeatChecker ¶ added in v1.1.0
type HeartbeatChecker struct {
// contains filtered or unexported fields
}
func (*HeartbeatChecker) BindConn ¶ added in v1.1.12
func (h *HeartbeatChecker) BindConn(conn ziface.IConnection)
BindConn 绑定一个链接
func (*HeartbeatChecker) BindRouter ¶ added in v1.1.0
func (h *HeartbeatChecker) BindRouter(msgID uint32, router ziface.IRouter)
func (*HeartbeatChecker) Clone ¶ added in v1.1.12
func (h *HeartbeatChecker) Clone() ziface.IHeartbeatChecker
CloneTo 克隆到一个指定的链接上
func (*HeartbeatChecker) MsgID ¶ added in v1.1.12
func (h *HeartbeatChecker) MsgID() uint32
func (*HeartbeatChecker) Router ¶ added in v1.1.12
func (h *HeartbeatChecker) Router() ziface.IRouter
func (*HeartbeatChecker) SendHeartBeatMsg ¶ added in v1.1.12
func (h *HeartbeatChecker) SendHeartBeatMsg() error
func (*HeartbeatChecker) SetHeartbeatFunc ¶ added in v1.1.15
func (h *HeartbeatChecker) SetHeartbeatFunc(beatFunc ziface.HeartBeatFunc)
func (*HeartbeatChecker) SetHeartbeatMsgFunc ¶ added in v1.1.0
func (h *HeartbeatChecker) SetHeartbeatMsgFunc(f ziface.HeartBeatMsgFunc)
func (*HeartbeatChecker) SetOnRemoteNotAlive ¶ added in v1.1.0
func (h *HeartbeatChecker) SetOnRemoteNotAlive(f ziface.OnRemoteNotAlive)
type HeatBeatDefaultRouter ¶ added in v1.1.0
type HeatBeatDefaultRouter struct {
BaseRouter
}
收到remote心跳消息的默认回调路由业务
func (*HeatBeatDefaultRouter) Handle ¶ added in v1.1.0
func (r *HeatBeatDefaultRouter) Handle(req ziface.IRequest)
Handle -
type MsgHandle ¶
type MsgHandle struct {
Apis map[uint32]ziface.IRouter //存放每个MsgID 所对应的处理方法的map属性
WorkerPoolSize uint32 //业务工作Worker池的数量
TaskQueue []chan ziface.IRequest //Worker负责取任务的消息队列
// contains filtered or unexported fields
}
MsgHandle 对消息的处理回调模块
func (*MsgHandle) AddInterceptor ¶ added in v1.1.1
func (mh *MsgHandle) AddInterceptor(interceptor ziface.IInterceptor)
func (*MsgHandle) SendMsgToTaskQueue ¶
SendMsgToTaskQueue 将消息交给TaskQueue,由worker进行处理
func (*MsgHandle) StartOneWorker ¶
StartOneWorker 启动一个Worker工作流程
func (*MsgHandle) StartWorkerPool ¶
func (mh *MsgHandle) StartWorkerPool()
StartWorkerPool 启动worker工作池
type Option ¶ added in v1.0.1
type Option func(s *Server)
Server的服务Option
func WithPacket ¶ added in v1.0.1
只要实现Packet 接口可自由实现数据包解析格式,如果没有则使用默认解析格式
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
Request 请求
func NewRequest ¶ added in v1.0.2
func NewRequest(conn ziface.IConnection, msg ziface.IMessage) *Request
func (*Request) BindRouter ¶ added in v1.0.2
func (*Request) GetConnection ¶
func (r *Request) GetConnection() ziface.IConnection
GetConnection 获取请求连接信息
func (*Request) GetMessage ¶ added in v1.1.1
GetMessage 获取消息实体
func (*Request) GetResponse ¶ added in v1.1.1
func (*Request) Goto ¶ added in v1.0.2
func (r *Request) Goto(step ziface.HandleStep)
func (*Request) SetResponse ¶ added in v1.1.1
type Server ¶
type Server struct {
//服务器的名称
Name string
//tcp4 or other
IPVersion string
//服务绑定的IP地址
IP string
//服务绑定的端口
Port int
//当前Server的链接管理器
ConnMgr ziface.IConnManager
// contains filtered or unexported fields
}
Server 接口实现,定义一个Server服务类
func (*Server) AddInterceptor ¶ added in v1.1.1
func (s *Server) AddInterceptor(interceptor ziface.IInterceptor)
func (*Server) GetHeartBeat ¶ added in v1.1.12
func (s *Server) GetHeartBeat() ziface.IHeartbeatChecker
func (*Server) GetLengthField ¶ added in v1.1.1
func (s *Server) GetLengthField() *ziface.LengthField
func (*Server) GetMsgHandler ¶ added in v1.1.0
func (s *Server) GetMsgHandler() ziface.IMsgHandle
func (*Server) GetOnConnStart ¶ added in v1.1.0
func (s *Server) GetOnConnStart() func(ziface.IConnection)
GetOnConnStart 得到该Server的连接创建时Hook函数
func (*Server) GetOnConnStop ¶ added in v1.1.0
func (s *Server) GetOnConnStop() func(ziface.IConnection)
得到该Server的连接断开时的Hook函数
func (*Server) SetDecoder ¶ added in v1.1.3
func (*Server) SetOnConnStart ¶
func (s *Server) SetOnConnStart(hookFunc func(ziface.IConnection))
SetOnConnStart 设置该Server的连接创建时Hook函数
func (*Server) SetOnConnStop ¶
func (s *Server) SetOnConnStop(hookFunc func(ziface.IConnection))
SetOnConnStop 设置该Server的连接断开时的Hook函数
func (*Server) StartHeartBeat ¶ added in v1.1.0
StartHeartBeat 启动心跳检测 interval 每次发送心跳的时间间隔
func (*Server) StartHeartBeatWithOption ¶ added in v1.1.0
func (s *Server) StartHeartBeatWithOption(interval time.Duration, option *ziface.HeartBeatOption)
StartHeartBeatWithFunc 启动心跳检测 option 心跳检测的配置
type WsClient ¶ added in v1.1.15
type WsClient struct {
//目标链接服务器的IP
Ip string
//目标链接服务器的端口
Port int
// contains filtered or unexported fields
}
func (*WsClient) AddInterceptor ¶ added in v1.1.15
func (c *WsClient) AddInterceptor(interceptor ziface.IInterceptor)
func (*WsClient) Conn ¶ added in v1.1.15
func (c *WsClient) Conn() ziface.IConnection
func (*WsClient) GetLengthField ¶ added in v1.1.15
func (c *WsClient) GetLengthField() *ziface.LengthField
func (*WsClient) GetMsgHandler ¶ added in v1.1.15
func (c *WsClient) GetMsgHandler() ziface.IMsgHandle
func (*WsClient) GetOnConnStart ¶ added in v1.1.15
func (c *WsClient) GetOnConnStart() func(ziface.IConnection)
GetOnConnStart 得到该Server的连接创建时Hook函数
func (*WsClient) GetOnConnStop ¶ added in v1.1.15
func (c *WsClient) GetOnConnStop() func(ziface.IConnection)
得到该Server的连接断开时的Hook函数
func (*WsClient) SetDecoder ¶ added in v1.1.15
func (*WsClient) SetOnConnStart ¶ added in v1.1.15
func (c *WsClient) SetOnConnStart(hookFunc func(ziface.IConnection))
设置该Client的连接创建时Hook函数
func (*WsClient) SetOnConnStop ¶ added in v1.1.15
func (c *WsClient) SetOnConnStop(hookFunc func(ziface.IConnection))
设置该Client的连接断开时的Hook函数
func (*WsClient) StartHeartBeat ¶ added in v1.1.15
StartHeartBeat 启动心跳检测 interval 每次发送心跳的时间间隔
func (*WsClient) StartHeartBeatWithOption ¶ added in v1.1.15
func (c *WsClient) StartHeartBeatWithOption(interval time.Duration, option *ziface.HeartBeatOption)
启动心跳检测(自定义回调)
type WsConnection ¶ added in v1.1.15
type WsConnection struct {
// contains filtered or unexported fields
}
WsConnection Websocket连接模块 用于处理 Websocket 连接的读写业务 一个连接对应一个Connection
func (*WsConnection) Context ¶ added in v1.1.15
func (c *WsConnection) Context() context.Context
返回ctx,用于用户自定义的go程获取连接退出状态
func (*WsConnection) GetConnID ¶ added in v1.1.15
func (c *WsConnection) GetConnID() uint64
GetConnID 获取当前连接ID
func (*WsConnection) GetConnection ¶ added in v1.1.15
func (c *WsConnection) GetConnection() net.Conn
func (*WsConnection) GetProperty ¶ added in v1.1.15
func (c *WsConnection) GetProperty(key string) (interface{}, error)
GetProperty 获取链接属性
func (*WsConnection) GetTCPConnection
deprecated
added in
v1.1.15
func (c *WsConnection) GetTCPConnection() net.Conn
Deprecated: use GetConnection instead
func (*WsConnection) GetWsConn ¶ added in v1.1.15
func (c *WsConnection) GetWsConn() *websocket.Conn
func (*WsConnection) IsAlive ¶ added in v1.1.15
func (c *WsConnection) IsAlive() bool
func (*WsConnection) LocalAddr ¶ added in v1.1.15
func (c *WsConnection) LocalAddr() net.Addr
LocalAddr 获取链接本地地址信息
func (*WsConnection) RemoteAddr ¶ added in v1.1.15
func (c *WsConnection) RemoteAddr() net.Addr
RemoteAddr 获取链接远程地址信息
func (*WsConnection) RemoveProperty ¶ added in v1.1.15
func (c *WsConnection) RemoveProperty(key string)
RemoveProperty 移除链接属性
func (*WsConnection) Send ¶ added in v1.1.15
func (c *WsConnection) Send(data []byte) error
func (*WsConnection) SendBuffMsg ¶ added in v1.1.15
func (c *WsConnection) SendBuffMsg(msgID uint32, data []byte) error
SendBuffMsg 发生BuffMsg
func (*WsConnection) SendMsg ¶ added in v1.1.15
func (c *WsConnection) SendMsg(msgID uint32, data []byte) error
SendMsg 直接将Message数据发送数据给远程的TCP客户端
func (*WsConnection) SendToQueue ¶ added in v1.1.15
func (c *WsConnection) SendToQueue(data []byte) error
func (*WsConnection) SetHeartBeat ¶ added in v1.1.15
func (c *WsConnection) SetHeartBeat(checker ziface.IHeartbeatChecker)
func (*WsConnection) SetProperty ¶ added in v1.1.15
func (c *WsConnection) SetProperty(key string, value interface{})
SetProperty 设置链接属性
func (*WsConnection) StartReader ¶ added in v1.1.15
func (c *WsConnection) StartReader()
StartReader 读消息Goroutine,用于从客户端中读取数据
func (*WsConnection) StartWriter ¶ added in v1.1.15
func (c *WsConnection) StartWriter()
StartWriter 写消息Goroutine, 用户将数据发送给客户端