MCPcopy
hub / github.com/aceld/zinx / business

Function business

examples/zinx_closecallback/client/client.go:16–30  ·  view source on GitHub ↗

business handles the main business logic for sending ping messages business 处理发送ping消息的主要业务逻辑

(conn ziface.IConnection)

Source from the content-addressed store, hash-verified

14// business handles the main business logic for sending ping messages
15// business 处理发送ping消息的主要业务逻辑
16func business(conn ziface.IConnection) {
17 for i := 0; i < 3; i++ {
18 err := conn.SendMsg(1, []byte(fmt.Sprintf("Ping %d", i+1)))
19 if err != nil {
20 fmt.Println("SendMsg error:", err)
21 break
22 }
23
24 time.Sleep(1 * time.Second)
25 }
26
27 // Actively disconnect after sending is complete / 发送完成后主动断开连接
28 fmt.Println("Client actively disconnects")
29 conn.Stop()
30}
31
32// DoClientConnectedBegin is the callback function when connection starts
33// DoClientConnectedBegin 是连接开始时的回调函数

Callers 1

DoClientConnectedBeginFunction · 0.70

Calls 2

SendMsgMethod · 0.65
StopMethod · 0.65

Tested by

no test coverage detected