views:

90

answers:

2

I've got a database on my server which is about 3mb big. I'd like to ship that with my iphone application.

The most important thing is that I'd like to promote changes to the database (insert, updates, deletes) to the iphone. What's the best way of doing that? I mean - what is necessary on - the server - the client (= iphone) - between; how to transfer this data?

I'm pretty free in using technologies serverside; right now, I've got an sqlite-database on the server filled with the data I'd like to sync to the iphones.

+1  A: 

How often do you need the database to be updated, and how urgent are the changes?

If the database updates are infrequent and non-urgent, I'd have the app check for a new version of the database on startup, and if it has changed, download the entire new file.

The app would always download a small metadata file from a known URL on startup. The metadata file contains an version identifier for the latest version and a location where that version of the database can be downloaded. If the version identifier has changed from the version the app already has, will download the new version. If the version identifier has not changed, or if it can't check, the app can keep using the version it has.

Pro tip: if you want to show a progress bar for the download, include the size of the database in the metadata file. Cell networks often have transparent proxies that strip out the Content-Length header from HTTP responses.

Will Harris
unfortunately, the updates are frequent and pretty urgent...
swalkner
A: 

Try using web hooks.

The concept of a WebHook is simple. A WebHook is an HTTP callback: an HTTP POST that occurs when something happens; a simple event-notification via HTTP POST.

A web application implementing WebHooks will POST a message to a URL when certain things happen. When a web application enables users to register their own URLs, the users can then extend, customize, and integrate that application with their own custom extensions or even with other applications around the web. For the user, WebHooks are a way to receive valuable information when it happens, rather than continually polling for that data and receiving nothing valuable most of the time. WebHooks have enormous potential and are limited only by your imagination! (No, it can't wash the dishes. Yet.)

You can find out more on Webhooks here: http://www.webhooks.org/ and http://webhooks.pbworks.com/

feketegy
hm... sounds interesting. I understand how web hooks work (at least, I think I do). But in combination with iPhone... how do I update the users of my application? That would only be possible with push notification, right? I mean - the have to register their phones with my application, and whenever something changes, I have to do a push notification - or am I missing something?
swalkner
Yes. Push notification could work.Either way, you have to give your registered users some sort of authentication.You can basically create a CRON job that sends out the notifications to a list of users (users who obviously are registered and authenticated)
feketegy