Hello,
I’m building an iOS application that supports peer-to-peer file transfer. My goal is to use the WebRTC data channel only (no audio or video) to send files between users.
I understand from Apple’s documentation that: • Apps are generally suspended in the background, and arbitrary sockets (like WebRTC) do not continue running. • Background file transfer is officially supported via URLSessionConfiguration.background, which the system manages reliably even if the app is suspended or terminated. • VoIP use cases require CallKit + audio/VoIP background modes, and CallKit must be used for legitimate calls (audio/video).
What I want to confirm is:
Is it supported for a WebRTC peer connection using only the data channel (no audio/video track, no CallKit call) to continue sending data when the app is in the background or locked?
I considered using BGProcessingTask and BGAppRefreshTask, but as far as I can tell, those don’t allow maintaining long-lived sockets for active data transfer. Real-world developer discussions suggest that WebRTC connections are dropped when the app is backgrounded on iOS unless there’s at least one active audio track to keep the session alive.
Can someone from Apple confirm if my understanding is correct—that data-only WebRTC connections will be killed in background unless they’re part of an active audio/video call with the appropriate entitlements?
Thanks in advance!
To expand on the above, there are two aspect to this:
- What’s technically feasible?
- What’s allowed by App Review?
I don’t work for App Review, so I can’t comment on the latter. If you’d like to discuss that aspect, I recommend that sign up for a session as explained by my colleague above.
On the technical side, you asked:
Is it supported for a WebRTC peer connection using only the data channel … to continue sending data when the app is in the background or locked?
The general rule for networking in the background on iOS is that (almost) everything works like it does in the foreground as long as your app is running. Once your app gets suspended, however, all low-level networking stops [1].
So, your question is equivalent to How can I run indefinitely in the background?, and that’s something I cover in iOS Background Execution Limits.
If you have follow-up questions about the technical side of this, I’m happy to answer them here.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
[1] Some high-level APIs will continue to work, most notably URLSession
background sessions.