Real time synchronization

I want to develop an application, the same as UBER, in which I need to show available taxis in the selected region and update, because taxis are hired, available, not available. Type of automatic update. Calling a web service in the background after a regular interval of time is not a good option. Can anyone suggest me a better and faster way to achieve this.

thanks

+7
synchronization ios iphone ios9
source share
4 answers

Click

  • Use sockets when the application is running. This will give you immediate updates.
  • Use push notifications when the application is down (use notifications for critical changes) and ignore these notifications when the application is already running, in favor of sockets.

Pull out

  • Use NSURLSession to update the local database with some regularity. It is very resistant to network failure.

Use a combination of approaches because speed and reliability are mutually exclusive. Ultimately, your goal is to keep the local database in sync with your server database and trigger internal messages when data changes. Not a small task, so the answer is Firebase.

+6
source share

The easiest way is to work with Firebase . There is no sql database, and you will have an instant update when you change something.

This video will help you quickly learn how to quickly get an update without any cycle for updating data in the application.

Ask me for any help related to Firebase.

0
source share

I would advise you to take a look at CloudKit . There are several reasons.

  • If you decide to simply create one application and somehow have a driver functionality that is different from users (perhaps there are registration and login drivers), then the application can publish general data to the public online database, accessible to all users. You can use the information in this script to publish local notifications as needed.
  • As iOS updates you will not depend on third-party libraries
  • If you decide to create a driver application and a separate user application, CloudKit will allow you to exchange data in these applications.
  • Apple is committed to security and accessibility.
  • In general, the process is very simple to implement.
  • You can combine local notifications with a public database of schedule reminders, user alerts, etc.
  • CloudKit, when executed correctly, will be essentially free. Just transfer CKAssets, not the raw data and your restrictions on transfer / storage become insignificant.
  • You can also access your CloudKit databases from an external network of services / websites if you want to expand the data further.
  • You can use CloudKit subscriptions to sync user information automatically

NB - As noted in the comments, this is a new technology. It is in the second generation, and I prefer it, because if he uses it creatively, you can simulate the behavior of an external push notification with background support. CloudKit eliminates the need for a third-party web server from which external notifications can be clicked (since real notifications occur by writing to a shared database).

Check out my detailed SO answer for sharing data between apps with CloudKit. Here is a link to some CloudKit videos that further describe how CloudKit works. Apple has many documentation and sample projects . You can browse the developer's website for more information about CloudKit .

Quick launch of CloudKit

0
source share

You can use silent push notifications to update your map with updated taxi locations.

0
source share

All Articles