0

I am developing an app on the iOS platform which would involve a lot of iPads simultaneously working on a file on a server, using online collaboration like in google docs. However, it needs to update in realtime. Therefore, I think the best way to do this would be for the server to communicate with each iPad every time there is a change in the document.

Unfortunately, to my knowledge, the only way for a server to communicate with an iPad is if the iPad first requested info from the server (HTTP GET or POST). Since I want realtime updating, and I don't want the iPad asking the server every nanosecond whether ether is an update, this doesn't work.

How can I program the server to communicate with the iPad without first requiring a request from it? All help is greatly appreciated.

danielmhanover
  • 3,094
  • 4
  • 35
  • 51
  • You can try this: each iPad sends a request at start-up, without a timeout. Your server does not respond to that message, and blocks waiting for data to appear on the queue of updates. When there is an update, your server sends it on the back of the response that's already queued up. When iPads finish processing the response, they send another request that gets blocked. Of course this sending of requests business needs to happen on a separate thread. – Sergey Kalinichenko May 12 '12 at 03:36

2 Answers2

2

Check this out, Apple's push notification service

http://www.raywenderlich.com/3443/apple-push-notification-services-tutorial-part-12

or much more relevant to your question,

COMET (server push to client) on iPhone

Community
  • 1
  • 1
TeaCupApp
  • 11,316
  • 18
  • 70
  • 150
0

Just keep an open socket to the server from each iPad. Every time the app restarts, reestablish the connection. While the connection is down, queue up any changes.

No big deal. No rocket science here.

Will Hartung
  • 115,893
  • 19
  • 128
  • 203