0

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.

Surya Subenthiran
  • 2,217
  • 1
  • 15
  • 22

2 Answers2

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.

Community
  • 1
  • 1
zoul
  • 102,279
  • 44
  • 260
  • 354