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) }
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) }