How do I send regular heartbeat packets to the server so it won't disconnect the client?

Every XMPP RFC compliant server implicitly supports responding to xep199 pings. I’m confident that your server does too. There is no need for whitespace pings anymore.