A Lightweight Socket Service with heartbeat, Can be easily used in TCP server development.
Wiki Page https://github.com/9b9387/zero/wiki
Go version: 1.9.x or later
go get -u github.com/9b9387/zero
import "github.com/9b9387/zero"
func main() {
host := "127.0.0.1:18787"
ss, err := zero.NewSocketService(host)
if err != nil {
return
}
// set Heartbeat
ss.SetHeartBeat(5*time.Second, 30*time.Second)
// net event
ss.RegMessageHandler(HandleMessage)
ss.RegConnectHandler(HandleConnect)
ss.RegDisconnectHandler(HandleDisconnect)
ss.Serv()
}
Example Code: https://github.com/9b9387/zero/blob/master/service_test.go
Unity Client Repository https://github.com/9b9387/zero_unity_demo