In my app I'm loading a website in a WKWebView. This website opens a WebSocket connection (CometD3). My problem is that the connection drops as soon as the app enters background.
I am aware that Apple requires developers to request special capabilities to keep socket connections opened in the background. My app doesn't fit the description of an app that Apple may allow this.
The requirement is not to keep it alive forever but to avoid reconnection when the user switches between apps or if they happen to be interrupted (e.g. phone call, text message). I'm look at about 30sec here.
I have already tried https://developer.apple.com/documentation/uikit/app_and_environment/scenes/preparing_your_ui_to_run_in_the_background/extending_your_app_s_background_execution_time but didn't work.
Also, I did not have this problem with UIWebView.