Hi, I made an Apple Watch App which use Websocket communication with wss://irc-ws.chat.twitch.tv:443. Unfortunately, WatchOS prevent Websocket for my usage.
https://developer.apple.com/documentation/technotes/tn3135-low-level-networking-on-watchos.
So my app doesn't work.
A workaround is to do the Websocket task on the IPhone and send messages to the Watch. It works perfectly as long as the app is open on the Phone, but it's really inconvenient for users.
I want to know if it's possible to continue this process till the phone app is in background ? If yes, how to do it ? The process could be long and must continue until the Watch App or the Phone app closed (this part is easy to detect).
I have already read documentations and tutorials about background processes, but none of them talk about long time process like Websocket communication or WatchConnectivity. I think I looked at the wrong place, or didn't use the right vocabulary.
Your watchOS app can resume your iOS app in the background using Watch Connectivity. That’s sufficient to get the process started but things get trickier from there. iOS does not, in general, allow apps to continue running in the background indefinitely. For more on that, see iOS Background Execution Limits.
The process could be long and must continue until the Watch App or the Phone app closed
What does “closed” mean? Users don’t really close apps on iOS. They can press the Home button [1] which moves the app to the background. Is that what you mean? Because that doesn’t seem to gel with the rest of this story, where you’re using expecting the iOS app to resume (or relaunch) in the background in response to a Watch Connectivity request.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
[1] Well, these days it’s more like “perform the Home gesture”.