Synchronization between mysql and IndexedDB - javascript

I like to develop an Desktop App using nw.js (node-webkit) or Electron.
I am looking for a solution to sync between IndexedDB and MySQL Server + PHP(Laravel) on the cloud via Restful API.
PouchDB look good but that is out of option because it only support to sync with CouchDB.
What option do I have?

It's possible with dexie but not as complete as you get with pouchdb. The closest you come to a complete solution with dexie is using the Dexie.Syncable addon (https://github.com/dfahlander/Dexie.js/wiki/Dexie.Syncable.js) (not yet stable) and implement the backend from the following 2 backend sample implementations:
https://github.com/dfahlander/Dexie.js/tree/master/samples/remote-sync/
If you don't want to rely on Dexie.syncable, another solution would be to build your own sync addon based on the stable CRUD hooks that Dexie provides in it's default api:
https://github.com/dfahlander/Dexie.js/wiki/Table.hook(%27creating%27)
https://github.com/dfahlander/Dexie.js/wiki/Table.hook(%27updating%27)
https://github.com/dfahlander/Dexie.js/wiki/Table.hook(%27deleting%27)
Using those hooks, may log all local changes to a dedicated table for syncing with server when it goes online. This is what Dexie.Syncable is based on.

Related

Store redux data that can be accessible with swift and java

I want to rewrite my React Native application with Java for Android and Swift for iOS. The thing is, I don't want to lose application data so that the user has to set up the application again.
Imagine we're on version 2.0.0 (Written in RN) and version 3.0.0 is written in Java and Swift. I want to store my redux store somewhere so that I can retrieve that on the native side and after the user updates the app.
I found this library to store app data into a .plist file that can be accessed with Swift later on. I don't know if that's the right way for iOS and also I have no clue of what should I do for Android side.
Note that I can't get the config file from the network and I'm using redux-persist to persist the data for my app.
Any help would be appreciated.
I guess you can integrate a minimum react native module within your new native apps, and make it provide a data migration path for your existing customers. Not sure how you will solve this with a decent UX though.
https://reactnative.dev/docs/integration-with-existing-apps

Local MongoDB implementation for Electron App

Im currently building a web app heavily based on MongoDB and Mongoose for the web app backend. The app will also have a desktop version based on electron. However as far as I’ve researched, including stackoverflow, you can’t package MongoDB with an electron app. The app might not be connected to the internet all the time. And hence I need a local store for it as well. This is where I want to use something like CouchDB or PouchDB.
The implementation I have come up with is this:
Store the data in a CouchDB/PouchDB
Check if there’s an Internet connection
If a connection can be established match the online MongoDB with the local CouchDB/PouchDB and add any entries not present in the database to MongoDB.
What I’d like to ask is if there’s a betterway to go about this?

Using MongoDB locally (electron)?

I need to store some data as part of my electron application. I know how to set up a REST API, and serve my application like so. However, is it also possible to use (e.g.) MongoDB locally, and implement something similar to a REST API locally? I would like to not assume an internet connection for this project.
If you need to implement a mongoDB like database locally for the application without internet, you can use lowdb
Yes it is possible, you have nodejs in electron so you can use mongoose:
https://github.com/Automattic/mongoose
But in this case every person who use your application have to install mongodb in his machine.

Storing data while processing an app through phonegap

I am using the Phonegap platform for developing an app and this runs on nexus 5 android 4.
The app is having a user interface through which it takes input from the user and processes it using the Javascript. My question is: Can I store/capture this data somewhere so that I can utilize it later. The utility can be sending the captured data to another server and getting a response from it for the specific data.
What is the best architectural way to accomplish this? Any thoughts highly appreciated.
There are many options to do this, IndexedDB, SQLite, localStorage, sessionStorage which are all HTML5 standards.
You might even be able to use XML file storage to do this.
Its your preference on what works best for you.

indexedDb backup in the cloud

I would like my client web app to be able to backup the indexedDb database.
I do not have a webserver
i found this: Exporting and importing IndexedDB data
that says: "you can call an export callback passing the privileged array of objects representing a backup of your object store"
so i have an array of objects in javascript which is my backup...
how can I :
1. turn it to a file?
2. back it up in the cloud?
thank you for your help.
Michael (belgium)
nb: I would love to use dropbox api, i have found this http://code.google.com/p/dropbox-js/source/browse/#svn/trunk but doesn't know if it works ( will try it and let you know).
nb: Also i am planning to use pokki.com to deploy app on client's desktop.
From https://developer.mozilla.org/en-US/docs/IndexedDB/Basic_Concepts_Behind_IndexedDB
Synchronizing. The API is not designed to take care of synchronizing with a server-side database. You have to write code that synchronizes a client-side indexedDB database with a server-side database.

Categories

Resources