I have an android app that uses background connections; it works fine on modern Android. The connections are broken when people walk in and out of WLAN coverage, but as long as the app uses minimal CPU and network traffic Android doesn't intercede much.
Hmmm. Doesn't Android Doze randomly kill/pause your background execution?
Not so I've really noticed. The user starting apps that require very much memory probably does too, but that's also a minor effect.
If you don't use scheduled jobs to reopen your connections, WLAN/mobile switching is a pain and there are some smaller similar pains. If you solve that big pain and make sure to use very little battery power, the smaller pains go away.
But iOS doesn't let you do background sockets, so you need push messages, and that's hard to coordinate between unrelated XMPP servers and clients. Of course, modern Android doesn't let you have background sockets either.