Defines the server interface
| 10 | |
| 11 | // Defines the server interface |
| 12 | type IServer interface { |
| 13 | Start() // Start the server method(启动服务器方法) |
| 14 | Stop() // Stop the server method (停止服务器方法) |
| 15 | Serve() // Start the business service method(开启业务服务方法) |
| 16 | |
| 17 | // Routing feature: register a routing business method for the current service for client link processing use |
| 18 | //(路由功能:给当前服务注册一个路由业务方法,供客户端连接处理使用) |
| 19 | AddRouter(msgID uint32, router IRouter) |
| 20 | |
| 21 | // New version of routing (新版路由方式) |
| 22 | AddRouterSlices(msgID uint32, router ...RouterHandler) IRouterSlices |
| 23 | |
| 24 | // Route group management (路由组管理) |
| 25 | Group(start, end uint32, Handlers ...RouterHandler) IGroupRouterSlices |
| 26 | |
| 27 | // Common component management (公共组件管理) |
| 28 | Use(Handlers ...RouterHandler) IRouterSlices |
| 29 | |
| 30 | // Get connection management (得到连接管理) |
| 31 | GetConnMgr() IConnManager |
| 32 | |
| 33 | // Set Hook function when the connection is created for the Server (设置该Server的连接创建时Hook函数) |
| 34 | SetOnConnStart(func(IConnection)) |
| 35 | |
| 36 | // Set Hook function when the connection is disconnected for the Server |
| 37 | // (设置该Server的连接断开时的Hook函数) |
| 38 | SetOnConnStop(func(IConnection)) |
| 39 | |
| 40 | // Get Hook function when the connection is created for the Server |
| 41 | // (得到该Server的连接创建时Hook函数) |
| 42 | GetOnConnStart() func(IConnection) |
| 43 | |
| 44 | // Get Hook function when the connection is disconnected for the Server |
| 45 | // (得到该Server的连接断开时的Hook函数) |
| 46 | GetOnConnStop() func(IConnection) |
| 47 | |
| 48 | // Get the data protocol packet binding method for the Server |
| 49 | // (获取Server绑定的数据协议封包方式) |
| 50 | GetPacket() IDataPack |
| 51 | |
| 52 | // Get the message processing module binding method for the Server |
| 53 | // (获取Server绑定的消息处理模块) |
| 54 | GetMsgHandler() IMsgHandle |
| 55 | |
| 56 | // Set the data protocol packet binding method for the Server |
| 57 | // (设置Server绑定的数据协议封包方式) |
| 58 | SetPacket(IDataPack) |
| 59 | |
| 60 | // Start the heartbeat check |
| 61 | // (启动心跳检测) |
| 62 | StartHeartBeat(time.Duration) |
| 63 | |
| 64 | // Start the heartbeat check (custom callback) |
| 65 | // 启动心跳检测(自定义回调) |
| 66 | StartHeartBeatWithOption(time.Duration, *HeartBeatOption) |
| 67 | |
| 68 | // Get the heartbeat checker |
| 69 | // (获取心跳检测器) |
no outgoing calls
no test coverage detected