Example #1
0
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)
}
Example #2
0
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)
}