ابرووا
شروع رایگان
☰ فهرست مستندات · نصب
به‌زودی. Abrova Sync به‌زودی فعال می‌شود. این صفحه توضیح می‌دهد چطور کار خواهد کرد؛ هنوز قابل استفاده نیست.
این صفحه هنوز ترجمه نشده — نسخه‌ی انگلیسی نمایش داده می‌شود. English

Installation

Install the Abrova Sync SDK for Flutter, React Native, Web, Android, iOS, Node.js, or use the REST API directly.

SDKs 0.3.0به‌روزرسانی: ۵ آبان ۱۴۰۵

AbrovaSync ships native SDKs for every major platform. Pick yours below — installation takes two steps from Abrova Center and no Firebase / Google dependencies are pulled in. If you'd rather skip an SDK, the REST API is available from any HTTP client.

Using an AI assistant? See AI assistants for how to give it these docs.

Flutter
abrova_sync ^0.3.0
React Native
@abrova/sync-react-native
Web
@abrova/sync-web
Android
abrova-sync-android:0.3.0
iOS
AbrovaSync 0.3.0 (SPM)
Node.js
@abrova/sync-node
REST API
No install required
Get your API key.

You'll need a Project API Key from the Abrova Console before initializing the SDK. Server-side use (Node.js or REST) also needs the Server Secret — never embed that in a mobile / web client.

What it will cost.

Free every month: 50,000 reads, 20,000 writes and 100 connections. Usage above that will cost from your prepaid wallet; the price is set at launch. See Pricing.

Every Abrova SDK installs from Abrova Center, the Abrova package registry, in two steps: add the registry once, then install the package.

Flutter#

yaml
# 1. pubspec.yaml: install from Abrova Center
dependencies:
  abrova_sync:
    hosted: https://center.abrova.ir/api/packages/abrova/pub
    version: ^0.3.0
bash
# 2. Install
flutter pub get

React Native#

bash
# 1. .npmrc in your project root: @abrova packages come from Abrova Center
@abrova:registry=https://center.abrova.ir/api/packages/abrova/npm/
bash
# 2. Install (npm or yarn)
npm install @abrova/sync-react-native
yarn add @abrova/sync-react-native

Web#

bash
# 1. .npmrc in your project root
@abrova:registry=https://center.abrova.ir/api/packages/abrova/npm/
bash
# 2. Install (npm or yarn)
npm install @abrova/sync-web
yarn add @abrova/sync-web

Android#

groovy
// 1. settings.gradle (or the project build.gradle): add Abrova Center
repositories {
    google()
    mavenCentral()
    maven { url "https://center.abrova.ir/api/packages/abrova/maven" }
}
kotlin
// 2. app/build.gradle(.kts)
dependencies {
    implementation("ir.abrova:abrova-sync-android:0.3.0")
}

iOS#

Add the package with Swift Package Manager. In Xcode: File → Add Package Dependencies…, paste the URL, choose the version. Or in Package.swift:

swift
dependencies: [
    .package(url: "https://github.com/Abrova-co/abrova-sync-ios-sdk.git", from: "0.3.0")
]

Node.js#

bash
# 1. .npmrc in your project root
@abrova:registry=https://center.abrova.ir/api/packages/abrova/npm/
bash
# 2. Install (npm, yarn or pnpm)
npm install @abrova/sync-node
yarn add @abrova/sync-node
pnpm add @abrova/sync-node

REST API#

No package install — just point any HTTP client at https://sync.abrova.ir. Every request carries your Project API Key, plus one of these:

bash
# Option 1: API Key + Server Secret (your backend only)
x-api-key: ab_live_YOUR_PROJECT_API_KEY
x-server-secret: ab_srv_YOUR_SERVER_SECRET
Content-Type: application/json

# Option 2: API Key + user token (acting as a signed-in user; the token is
# minted by your backend - see Security Rules)
x-api-key: ab_live_YOUR_PROJECT_API_KEY
x-user-token: USER_TOKEN_FROM_YOUR_BACKEND
Content-Type: application/json

Upgrading to 0.3.0#

Version 0.3.0 is released for all six SDKs together and changes some behavior. Check these points when you upgrade from 0.2.x:

set() replaces the document. Fields you leave out are removed. Before 0.3.0, set() merged into the existing document. To keep merging, pass the merge option. WriteBatch.set() takes the same option. Writes that were queued offline before the upgrade keep the meaning they had when they were made.

dart
// Flutter
await todos.set('todo-1', {'completed': true}, merge: true);
batch.set(todos, 'todo-1', {'completed': true}, merge: true);
typescript
// React Native
await todos.set('todo-1', { completed: true }, { merge: true });
batch.set(todos, 'todo-1', { completed: true }, { merge: true });

// Web
await todos.document('todo-1').set({ completed: true }, { merge: true });
batch.set(todos.document('todo-1'), { completed: true }, { merge: true });

// Node.js
await todos.doc('todo-1').set({ completed: true }, { merge: true });
batch.set(todos.doc('todo-1'), { completed: true }, { merge: true });
kotlin
// Android
todos.set("todo-1", mapOf("completed" to true), merge = true)
batch.set(todos, "todo-1", mapOf("completed" to true), merge = true)
swift
// iOS
try await todos.set(documentId: "todo-1", data: ["completed": true], merge: true)
batch.set(todos, documentId: "todo-1", data: ["completed": true], merge: true)

Flutter: catch AbrovaSyncError. Failed calls (add, get, getAll, update, set, delete, query.get(), batch.commit(), connect(), and database and collection calls) throw an AbrovaSyncError instead of a PlatformException. Where you caught PlatformException, catch AbrovaSyncError:

dart
try {
  await todos.update('todo-1', {'completed': true});
} on AbrovaSyncError catch (e) {
  print('${e.code} (${e.statusCode}): ${e.message}');
}

Web and Node.js: get() returns the document. On the Web SDK, doc.get() returns the document ({ id, data, version, ... }). On the Node.js SDK, get() and add() return it too. Before 0.3.0 the document came wrapped in an extra object, so its fields were at doc.data.data. If your code reads doc.data.data, read doc.data now.

Listeners are checked by your security rules. A listener is allowed only when the rules allow every document it could receive, exactly like a query. A listener that the rules do not allow now ends with an error. Filter it on the fields your rules read. See Realtime Listeners and Security Rules.

With offline persistence, refusals are no longer hidden. The cache stands in only when the server cannot be reached. When the server refuses a request (your security rules, invalid data), the call throws: reads are not answered from the cache, and writes are not queued. See Offline Persistence.

iOS: two new error cases. AbrovaSyncError has the new cases queryNotAllowed and listenerRevoked. If you switch over AbrovaSyncError without a default, add them.

Web: disconnect() takes the SDK offline. After disconnect() or goOffline(), writes are queued and reads come from the cache until you call reconnect(). The SDK no longer reconnects by itself when the browser comes back online after disconnect().

maxSyncRetries has no effect. It is deprecated on every SDK. A queued write is retried until it goes through, and a write the server refuses is rolled back. Remove the setting when convenient. Your code still compiles while it is there.

Error types and status codes per platform are listed in Platform Notes.

Next: initialize and connect.

این صفحه مفید بود؟
گزارش مشکل