What's the best way to do one-way synching from a server-side database to iPhone?
Asked Answered
A

3

6

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.

Aerothermodynamics answered 21/1, 2010 at 11:47 Comment(0)
E
1

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/

Euripides answered 24/1, 2010 at 17:30 Comment(2)
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?Aerothermodynamics
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)Euripides
L
2

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.

Ledaledah answered 21/1, 2010 at 15:18 Comment(0)
E
1

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/

Euripides answered 24/1, 2010 at 17:30 Comment(2)
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?Aerothermodynamics
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)Euripides
M
1

Wonder if you have considered using a Sync Framework to manage the synchronization. If that interests you can take a look at the open source project, OpenMobster's Sync service. You can do the following sync operations

  • two-way
  • one-way client
  • one-way device
  • bootup

Besides that, all modifications are automatically tracked and synced with the Cloud. You can have your app offline when network connection is down. It will track any changes and automatically in the background synchronize it with the cloud when the connection returns. It also provides synchronization like iCloud across multiple devices

Also, modifications in the Cloud are synched using Push notifications, so the data is always current even if it is stored locally.

Here is a link to the open source project: http://openmobster.googlecode.com

Here is a link to iPhone App Sync: http://code.google.com/p/openmobster/wiki/iPhoneSyncApp

Measureless answered 18/3, 2012 at 17:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.