I have an iOS app which is installed in two different device but logged in with same account. If I do a new post from a device it should be shown instantly in the other devices. Currently I am refreshing the posts feed for every 10 seconds interval. Is this is a optimal way or is there any other better solution for this.
Asked
Active
Viewed 62 times
0
-
1push notifications are pretty much designed for situations like this – wattson12 Nov 29 '13 at 10:33
-
thanks @wattson12. If the second device's app is in background state the push notification will be shown in status bar. But i don't need that. Is there any other way? – Surya Subenthiran Nov 29 '13 at 10:41
-
if the device is in the background you wouldn't have previously known about any new content anyway right? – wattson12 Nov 29 '13 at 11:20
2 Answers
1
As @wattson12 was saying push notification are designed for that. I would recommend using an API for that : Urban Air Ship

Pull
- 2,236
- 2
- 16
- 32
1
What you do is called polling. It’s the simplest solution, but it’s not optimal, because it requires you to query the server constantly and still there’s delay before you know about the new posts.
One way to know about new posts is to keep an HTTP connection open, waiting for the server to notify you about new posts (see Wikipedia for details, also related question here). Other option is push notifications: the server can post a notification when new content arrives. I’m not sure which one is technically more simple.