I'm making a chat app for iPhone, but im not sure how conversation messages should come instantly.
I have read tons of Google results on this topic. Also the once on:
- http://www.raywenderlich.com/3932/how-to-create-a-socket-based-iphone-app-and-server
- http://www.raywenderlich.com/3443/apple-push-notification-services-tutorial-part-12
APNS approach:
An invisible notification will be pushed to the iPhone indicating that a new message is ready to be read. So the app will make a request for unread messages. So instead of manually polling new messages, I will let APNS help with that. But I'm not sure?
Sockets approach:
Making a socket connection that is open to share data. When new messages is found in db, it will automatic send the data to the app. But what about IP range, firewall, power consumption, other things? again I'm not sure :(
Polling approach:
Make a time interval where I poll request, power consumption is my enemy here.
My question:
- Which approach is best?
- Other suggestions?
- I really need some cons and pros from people with experience on this topic.
Examples is always good.
Thanks