Documentation ¶
Index ¶
- Constants
- type CBTask
- type Client
- func (c *Client) ConnectTo(addr string) error
- func (c *Client) ConnectToTLS(addr string, skipVerify bool) error
- func (c *Client) ConnectedStatus() bool
- func (c *Client) Disconnect()
- func (c *Client) MsgChannel() chan *ClientMsg
- func (c *Client) SendNotify(route string, data []byte) error
- func (c *Client) SendRequest(route string, data []byte, cb CBTask) (uint, error)
- func (c *Client) WaitReady()
- type ClientMsg
- type HandshakeData
- type HandshakeSys
Constants ¶
View Source
const (
ReqeustTimeout = 15 * time.Second
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { Connected bool // 握手完毕 Ready bool IncomingMsgChan chan *ClientMsg // contains filtered or unexported fields }
Client 重连在上层处理 携程
readServerMessages 读取消息 组织成packet handlePackets 处理packet sendHeartbeats 定时发送heartbeat pendingRequestsReaper 移除超时未返回的请求
func (*Client) ConnectTo ¶
ConnectTo connects to the server at addr, for now the only supported protocol is tcp this methods blocks as it also handles the messages from the server
func (*Client) ConnectToTLS ¶
ConnectToTLS connects to the server at addr using TLS, for now the only supported protocol is tcp this methods blocks as it also handles the messages from the server
func (*Client) ConnectedStatus ¶
ConnectedStatus return the connection status
func (*Client) MsgChannel ¶
MsgChannel return the incoming message channel
func (*Client) SendNotify ¶
SendNotify sends a notify to the server
func (*Client) SendRequest ¶
SendRequest sends a request to the server
type HandshakeData ¶
type HandshakeData struct { Code int `json:"code"` Sys HandshakeSys `json:"sys"` }
HandshakeData struct
Click to show internal directories.
Click to hide internal directories.