Thank you so much for extended answer!
Yes, I know about TCP and NSStreamNetworkServiceTypeVoIP. We can introduce TCP socket for legacy support VoIP service but it is late (As far as I know this VoIP arch is not supported after iOS 10).
Now our UDP peer-to-peer system/protocol:
- System performs in local area network only (WiFi).
- UDP broadcast socket for discovery new peers in local area network (WiFi).
- UDP unicast socket for transfer data between discovered peers.
- All peers from one WiFi network are connected to each other.
- We have no problems between background/foreground switching. We reopen all UDP sockets. It is simple, cheap, and has no user visible consequences.
Of course we want to work in background mode and stay connection between all peers in current WiFi network, this needs for notify about new incoming messages, files and voice calls. This solution have 2 main advantage points:
1. Low cost. No need in servers.
2. No need internet connection, just WiFi network.
We also know about Apple battery optimization and PushKit and it is very important part of iOS device. We have very good testing results of our system: CPU efficient, memory usage and energy consumption. We hope in the future Apple will introduce some network service app extension for these goals (implementation user defined protocol as a some service process). May be Apple will implement PushKit extension for local area network only, or something else. As a result we will have new more interesting apps in the App Store.
Thanks!