synchronize Local database with Web

Asked

Viewed 1,201 times

6

I’m developing an application in Cakephp, with a Mysql database. a part is already working but from the beginning I need a solution to the following problem:

My application should work online, but also offline. The internet may fall, in this case the application should save and consult a local database, but when online, these two banks should be synchronized. Remembering that in the meantime, the online bank could also suffer some change.

What better way to do something like this??

The application is an order registration system. It is for a merchant. Orders are registered with information type: Value, date, delivery date, payment date, supplier, form of payment, etc... And there are users, simple cakephp authentication.

What happens is that there is not always internet, so it is necessary that the system can work saving in a local bank and then synchronizing with the online BD when there is connection.

In a second moment I can think about making a desktop app, which will probably use this synchronization logic as well as a mobile app. But always centralizing and distributing information through a single web server.

  • 2

    It’s a very interesting problem, but you need to provide more information about your application, what does it do? does it have users? users interact with things that affect other users? the solution will depend a lot on the context and depending on your case it may not even be possible to build something reliable in this architecture.

  • The application is an order registration system. It is for a merchant. Orders are registered with information type: Value, date, delivery date, payment date, supplier, form of payment, etc... And then there are the users, simple cakephp authentication. What happens is that there is not always internet, so it is necessary that the system can work saving in a local bank and then synchronizing with the online BD when there is connection.

  • And users can change someone else’s registration? for example I register a request and another user can edit this request?

  • yes, just admin login and password to enter and edit, register or delete. Including edit from other users yes.

  • Hm, it is possible to do something like this but it is reasonably complicated and you will get conflict issues due to one user being able to edit requests from others. I’ll see if I can come up with an answer.

  • OK, thank you !!

  • The central bank will be updated by someone or only by the synchronization of other banks?

  • Whichever is easier.

  • You had some solution for this case @Lucianobraga, if you have shared with us, I’m also in need of a solution for a similar case

  • The solution I found even now for a similar project was to use Firebase. It allows synchronization of data, keeping a database offline in case there is anyone on the connection. You can create something like this through Indexeddb, but Firestore already offers all this point to use.

Show 5 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.