My application needs an open connection to the server for real-time updates. I need to be able to navigate through multiple views during which I can send and receive data asynchronously. The goal is for the application to automatically update data in real time.
What I would like to do is to have a separate socket manager class inheriting from NSObject, which has CocoaAsyncSocket delegation functions plus some helper functions, and then when something happens to a persistent socket that is being processed inside the class, and it sends notifications that have different effects, depending on what form you are currently in.
What is the preferred way to do this? Configure the protocol for this socket manager, and each user interface will be a delegate *? Or would I be better if the socket manager was sitting in the background thread and sending notifications? Is there a preferred battery life choice?
* More or less like http://www.raywenderlich.com/3932/how-to-create-a-socket-based-iphone-app-and-server
source share