I'm creating an app that is streaming video data from the phone to a server. Specifically, I'm grabbing frames from the phone's screen and am sending those. There's a moment when I have to show a system dialog. When I do, though the app remains visible, the app's events indicate it is being put into the background. The moment it does this my various connections (including a WebSocketTask) are terminated. I attempted to configure the WebSocketTask with a URL session that could work in the background. But upon instantiation I get the error:
WebSocket tasks are not supported in background sessions
Is there something I can do to keep the WebSocket connection alive? If it could survive in the background for 30 seconds, that would be enough.
Everything I'm reading suggest that connections own by the application cannot be persisted in the background. I see a number of background scenarios such as downloading a file that are not applicable to my use case.