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

Function DoConnectionBegin

examples/zinx_mutiport/server/server.go:15–26  ·  view source on GitHub ↗

Execute when creating a connection (创建连接的时候执行)

(conn ziface.IConnection)

Source from the content-addressed store, hash-verified

13
14// Execute when creating a connection (创建连接的时候执行)
15func DoConnectionBegin(conn ziface.IConnection) {
16 zlog.Ins().InfoF("DoConnectionBegin is Called ...")
17
18 //设置两个连接属性,在连接创建之后
19 conn.SetProperty("Name", "Aceld")
20 conn.SetProperty("Home", "https://yuque.com/@aceld")
21
22 err := conn.SendMsg(2, []byte("DoConnection BEGIN..."))
23 if err != nil {
24 zlog.Error(err)
25 }
26}
27
28// Execute when connection lost (连接断开的时候执行)
29func DoConnectionLost(conn ziface.IConnection) {

Callers

nothing calls this directly

Calls 5

InsFunction · 0.92
ErrorFunction · 0.92
InfoFMethod · 0.65
SetPropertyMethod · 0.65
SendMsgMethod · 0.65

Tested by

no test coverage detected