示例#1
0
文件: client.go 项目: sanbit/swnet
func onKeepaliveAck(session *swnet.Session, packet protocol.Packet) {
	fmt.Println("keepalive ack")
	ack := packet.(*protocol.KeepaliveAck)
	req := protocol.NewKeepalive()
	req.Token = ack.Token + 1
	req.Version = ack.Version
	session.AsyncSend(req)
}
示例#2
0
文件: server.go 项目: sanbit/swnet
func onKeepalive(session *swnet.Session, packet protocol.Packet) {
	fmt.Println("keepalive")
	req := packet.(*protocol.Keepalive)
	ack := protocol.NewKeepaliveAck()
	ack.Token = req.Token
	ack.Version = req.Version
	session.AsyncSend(ack)
}