Here a client socket application which also run on the same machine post messages to socket server.
If I’m reading this correctly, your plan is to have two separate applications, one running a WebSocket server and the other connecting to it. Is that right?
If so, you’re going to run into problems here. The issue is not with the networking because with iOS’s execution model. As described in Technote 2277 Networking and Multitasking, an iOS app can use networking APIs in the background just fine, as long as its not suspended. Once it’s suspended, all bets are off. This is problematic in the case of your server app, where it’ll not be able to handle network requests after the use moves it to the background.
You can use a
UIApplication
background task to delay this for a while, but those only work for a very short period of time. Unless your server app is able to keep running in the background for some other reason, this architecture won’t work on iOS.
Share and Enjoy
—
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"