Start starts the client, sends requests and establishes a connection. (启动客户端,发送请求且建立连接)
()
| 226 | // Start starts the client, sends requests and establishes a connection. |
| 227 | // (启动客户端,发送请求且建立连接) |
| 228 | func (c *Client) Start() { |
| 229 | |
| 230 | // Add the decoder to the interceptor list (将解码器添加到拦截器) |
| 231 | if c.decoder != nil { |
| 232 | c.msgHandler.AddInterceptor(c.decoder) |
| 233 | } |
| 234 | |
| 235 | c.Restart() |
| 236 | } |
| 237 | |
| 238 | // StartHeartBeat starts heartbeat detection with a fixed time interval. |
| 239 | // interval: the time interval between each heartbeat message. |