Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pervasync/react-native-sync
Two way, incremental sync between React Native realmjs database and MySQL, Oracle, MS SQL Server and PostgreSQL
https://github.com/pervasync/react-native-sync
Last synced: 6 days ago
JSON representation
Two way, incremental sync between React Native realmjs database and MySQL, Oracle, MS SQL Server and PostgreSQL
- Host: GitHub
- URL: https://github.com/pervasync/react-native-sync
- Owner: pervasync
- License: mit
- Created: 2018-03-17T20:23:26.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-03-05T22:56:14.000Z (almost 2 years ago)
- Last Synced: 2024-10-04T00:23:12.720Z (2 months ago)
- Language: JavaScript
- Size: 235 KB
- Stars: 58
- Watchers: 4
- Forks: 11
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-react-native - react-native-sync ★28 - Two way, incremental sync between React Native realmjs database and MySQL, Oracle, MS SQL Server and PostgreSQL (Components / Backend)
- awesome-react-native - react-native-sync ★28 - Two way, incremental sync between React Native realmjs database and MySQL, Oracle, MS SQL Server and PostgreSQL (Components / Backend)
- awesome-react-native - react-native-sync ★28 - Two way, incremental sync between React Native realmjs database and MySQL, Oracle, MS SQL Server and PostgreSQL (Components / Backend)
- awesome-react-native - react-native-sync ★28 - Two way, incremental sync between React Native realmjs database and MySQL, Oracle, MS SQL Server and PostgreSQL (Components / Backend)
README
# react-native-sync
Two way, incremental sync between React Native realmjs databases and MySQL, Oracle, MS SQL Server and PostgreSQL databases.
## Features
* Direct DB synchronization between on device [realmjs DB](https://realm.io/docs/javascript/latest/) and server side MySQL, Oracle, MS SQL Server and PostgreSQL databases
* Each user could subscribe to a subset of server side data
* Files can also be syned## Setup
For end-to-end testing, you need to first setup a Pervasync server and publish your central database tables for sync. See [Pervasync documentation](https://docs.google.com/document/u/1/d/1Oioo0MxSArRgBdZ0wmLND-1AdzVLyolNd-yWw59tIC8/pub) for instructions.
This library is available on npm, install it with: `npm install --save react-native-sync` or `yarn add react-native-sync`.
## Usage
1. Import react-native-sync as RNSync:
```javascript
import RNSync from "react-native-sync";
```2. Configure RNSync:
```javascript
var settings = {
syncServerUrl: "http://localhost:8080/pervasync/server", // required
syncUserName: "user_1", // required
syncUserPassword: "welcome1", // required
};
await RNSync.config(settings);
```3. Start a sync session:
```javascript
let syncSummary = await RNSync.sync();
```4. Get a handle to the synced realm database and synced folder path:
```javascript
let realm = await RNSync.getRealm(syncSchemaName);
let path = await RNSync.getPath(syncFolderName);
```## Complete Example
Check out [react-native-sync-demo](https://github.com/pervasync/react-native-sync-demo) and expecially [sync.js](https://github.com/pervasync/react-native-sync-demo/blob/master/sync.js)