You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -47,7 +47,7 @@ If you are using GitHub pages for hosting, this command is a convenient way to b
47
47
We truly appreciate your interest in this project!
48
48
This project is **community-maintained**, which means it's **not officially supported** by our support team.
49
49
50
-
If you need help, have found a bug, or want to contribute improvements, the best place to do that is right here — by [opening a GitHub issue](https://github.com/Couchbase-Ecosystem/cbl-reactnative-docs/issues).
50
+
If you need help, have found a bug, or want to contribute improvements, the best place to do that is right here - by [opening a GitHub issue](https://github.com/Couchbase-Ecosystem/cbl-reactnative-docs/issues).
51
51
Our support portal is unable to assist with requests related to this project, so we kindly ask that all inquiries stay within GitHub.
52
52
53
-
Your collaboration helps us all move forward together — thank you!
53
+
Your collaboration helps us all move forward together - thank you!
Copy file name to clipboardExpand all lines: docs/DataSync/remote-sync-gateway.md
+28-24Lines changed: 28 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ sidebar_position: 2
5
5
6
6
# Remote Sync
7
7
8
-
> Description - _Couchbase Lite for Ionic — Synchronizing data changes between local and remote databases using Sync Gateway or Capella App Services_
8
+
> Description - _Couchbase Lite for Ionic - Synchronizing data changes between local and remote databases using Sync Gateway or Capella App Services_
9
9
10
10
:::note
11
11
All code examples are indicative only. They demonstrate the basic concepts and approaches to using a feature. Use them as inspiration and adapt these examples to best practice when developing applications for your platform.
@@ -56,7 +56,7 @@ Couchbase Mobile uses a replication protocol based on WebSockets for replication
56
56
57
57
#### Incompatibilities
58
58
59
-
Couchbase Lite’s replication protocol is incompatible with CouchDB-based databases. And since Couchbase Lite 2.x+ only supports the new protocol, you will need to run a version of Sync Gateway that supports it — see: [Compatibility](../ProductNotes/compatibility.md).
59
+
Couchbase Lite’s replication protocol is incompatible with CouchDB-based databases. And since Couchbase Lite 2.x+ only supports the new protocol, you will need to run a version of Sync Gateway that supports it - see: [Compatibility](../ProductNotes/compatibility.md).
60
60
61
61
### Ordering
62
62
@@ -86,15 +86,15 @@ For backward compatibility with the code prior to >= 3.1, when you set up the re
Note use of the scheme prefix (`wss://` to ensure TLS encryption — strongly recommended in production — or `ws://`)
262
+
Note use of the scheme prefix (`wss://` to ensure TLS encryption - strongly recommended in production - or `ws://`)
263
263
:::
264
264
265
265
### Sync Mode
@@ -298,7 +298,7 @@ In the event it detects a transient error, the replicator will attempt to reconn
298
298
299
299
On each retry the interval between attempts is increased exponentially (exponential backoff) up to the maximum wait time limit (5 minutes).
300
300
301
-
The REST API provides configurable control over this replication retry logic using a set of configiurable properties — see: [Table 1](#table-1-replication-retry-configuration-properties).
301
+
The REST API provides configurable control over this replication retry logic using a set of configiurable properties - see: [Table 1](#table-1-replication-retry-configuration-properties).
@@ -308,7 +308,7 @@ The REST API provides configurable control over this replication retry logic usi
308
308
|`maxAttempts()`| Change this to limit or extend the number of retry attempts. | The maximum number of retry attempts. <br/> <br/> Set to zero (0) to use default values. <br/> <br/> Set to one (1) to prevent any retry attempt. <br/> <br/> The retry attempt count is reset when the replicator is able to connect and replicate. <br/> <br/> Default values are: <br/> - Single-shot replication = 9 <br/> - Continuous replication = maximum integer value. <br/> <br/> Negative values generate a Couchbase exception `InvalidArgumentException`. |
309
309
|`maxAttemptWaitTime()`| Change this to adjust the interval between retries. | The maximum interval between retry attempts. <br/> <br/> While you can configure the maximum permitted wait time, the replicator’s exponential backoff algorithm calculates each individual interval which is not configurable. <br/> <br/> Default value: 300 seconds (5 minutes). <br/> <br/> Zero sets the maximum interval between retries to the default of 300 seconds. <br/> <br/> 300 sets the maximum interval between retries to the default of 300 seconds. <br/> <br/> A negative value generates a Couchbase exception, `InvalidArgumentException`. |
310
310
311
-
When necessary you can adjust any or all of those configurable values — see: [Example 5](#example-5-configuring-replication-retries) for how to do this.
311
+
When necessary you can adjust any or all of those configurable values - see: [Example 5](#example-5-configuring-replication-retries) for how to do this.
312
312
313
313
#### Example 5. Configuring Replication Retries
314
314
@@ -462,7 +462,7 @@ await replicator.start();
462
462
463
463
Custom headers can be set on the configuration object. The replicator will then include those headers in every request.
464
464
465
-
This feature is useful in passing additional credentials, perhaps when an authentication or authorization step is being done by a proxy server (between Couchbase Lite and Sync Gateway) — see [Example 10](#example-10-setting-custom-headers).
465
+
This feature is useful in passing additional credentials, perhaps when an authentication or authorization step is being done by a proxy server (between Couchbase Lite and Sync Gateway) - see [Example 10](#example-10-setting-custom-headers).
466
466
467
467
#### Example 10. Setting custom headers
468
468
@@ -506,6 +506,10 @@ await replicator.start();
506
506
507
507
1. The callback should follow the semantics of a [pure function](https://en.wikipedia.org/wiki/Pure_function). Otherwise, long running functions would slow down the replicator considerably.
508
508
509
+
:::note Version 1.1
510
+
Android replication filters now support JavaScript arrow functions in the V8 evaluation path.
511
+
:::
512
+
509
513
##### Pull Filter
510
514
511
515
The pull filter gives an app the ability to validate documents being pulled, and skip ones that fail. This is an important security mechanism in a peer-to-peer topology with peers that are not fully trusted.
@@ -585,7 +589,7 @@ Users may lose access to channels in a number of ways:
585
589
* User is removed from a role
586
590
* A channel is removed from a role the user is assigned to
587
591
588
-
By default, when a user loses access to a channel, the next Couchbase Lite Pull replication auto-purges all documents in the channel from local Couchbase Lite databases (on devices belonging to the user) unless they belong to any of the user’s other channels — see: [Table 2](#table-2-behavior-following-access-revocation).
592
+
By default, when a user loses access to a channel, the next Couchbase Lite Pull replication auto-purges all documents in the channel from local Couchbase Lite databases (on devices belonging to the user) unless they belong to any of the user’s other channels - see: [Table 2](#table-2-behavior-following-access-revocation).
589
593
590
594
Documents that exist in multiple channels belonging to the user (even if they are not actively replicating that channel) are not auto-purged unless the user loses access to all channels.
591
595
@@ -604,7 +608,7 @@ Users will be receive an `AccessRemoved` notification from the DocumentListener
604
608
|| Sync Function includes `requireAccess(revokedChannel)`| Local changes continue to be pushed to remote but are rejected by Sync Gateway |
605
609
606
610
607
-
If a user subsequently regains access to a lost channel, then any previously auto-purged documents still assigned to any of their channels are automatically pulled down by the active Sync Gateway when they are next updated — see behavior summary in [Table 3](#table-3-behavior-if-access-is-regained).
611
+
If a user subsequently regains access to a lost channel, then any previously auto-purged documents still assigned to any of their channels are automatically pulled down by the active Sync Gateway when they are next updated - see behavior summary in [Table 3](#table-3-behavior-if-access-is-regained).
608
612
609
613
#### Table 3. Behavior if access is regained
610
614
@@ -639,7 +643,7 @@ This is an [Enterprise Edition](https://www.couchbase.com/products/editions/) fe
639
643
640
644
With Delta Sync, only the changed parts of a Couchbase document are replicated. This can result in significant savings in bandwidth consumption as well as throughput improvements, especially when network bandwidth is typically constrained.
641
645
642
-
Replications to a Server (for example, a Sync Gateway, or passive listener) automatically use delta sync if the property is enabled at database level by the server — see: [databases.$db.delta_sync.enabled](https://docs.couchbase.com/sync-gateway/current/configuration-properties-legacy.html#databases-foo_db-delta_sync).
646
+
Replications to a Server (for example, a Sync Gateway, or passive listener) automatically use delta sync if the property is enabled at database level by the server - see: [databases.$db.delta_sync.enabled](https://docs.couchbase.com/sync-gateway/current/configuration-properties-legacy.html#databases-foo_db-delta_sync).
@@ -669,7 +673,7 @@ Replicators use `checkpoints` to keep track of documents sent to the target data
669
673
670
674
Without `checkpoints`, Couchbase Lite would replicate the entire database content to the target database on each connection, even though previous replications may already have replicated some or all of that content.
671
675
672
-
This functionality is generally not a concern to application developers. However, if you do want to force the replication to start again from zero, use the `checkpoint` reset argument when starting the replicator — as shown in Example 13.
676
+
This functionality is generally not a concern to application developers. However, if you do want to force the replication to start again from zero, use the `checkpoint` reset argument when starting the replicator - as shown in Example 13.
673
677
674
678
#### Example 13. Resetting checkpoints
675
679
@@ -691,7 +695,7 @@ The default `false` is shown here for completeness only; it is unlikely you woul
691
695
692
696
You can monitor a replication’s status by using a combination of `Change Listeners` and the `Replicator.getStatus()` property. This enables you to know, for example, when the replication is actively transferring data and when it has stopped.
693
697
694
-
You can also choose to monitor document changes — see: [Monitor Document Changes](#monitor-document-changes).
698
+
You can also choose to monitor document changes - see: [Monitor Document Changes](#monitor-document-changes).
695
699
696
700
### Change Listeners
697
701
@@ -701,21 +705,21 @@ Use this to monitor changes and to inform on sync progress; this is an optional
701
705
Don’t forget to save the token so you can remove the listener later
702
706
:::
703
707
704
-
Use the `Replicator` class to add a change listener as a callback to the Replicator (`addChangeListener()`) — see: [Example 14](#example-14-monitor-replication). You will then be asynchronously notified of state changes.
708
+
Use the `Replicator` class to add a change listener as a callback to the Replicator (`addChangeListener()`) - see: [Example 14](#example-14-monitor-replication). You will then be asynchronously notified of state changes.
705
709
706
710
You can remove a change listener with `removeChangeListener(token)`.
707
711
708
712
### Replicator Status
709
713
710
-
You can use the `Replicator.getStatus()` property to check the replicator status. That is, whether it is actively transferring data or if it has stopped — see: [Example 14](#example-14-monitor-replication).
714
+
You can use the `Replicator.getStatus()` property to check the replicator status. That is, whether it is actively transferring data or if it has stopped - see: [Example 14](#example-14-monitor-replication).
711
715
712
716
The returned *ReplicationStatus* structure comprises:
713
717
714
-
*`ActivityLevel` — stopped, offline, connecting, idle or busy — see states described in: [Table 5](#table-5-replicator-activity-levels)
718
+
*`ActivityLevel` - stopped, offline, connecting, idle or busy - see states described in: [Table 5](#table-5-replicator-activity-levels)
715
719
716
720
*`Progress`
717
-
* completed — the total number of changes completed
718
-
* total — the total number of changes to be processed
721
+
* completed - the total number of changes completed
722
+
* total - the total number of changes to be processed
719
723
720
724
*`Error` - the current error, if any.
721
725
@@ -804,7 +808,7 @@ await token.remove();
804
808
805
809
The following diagram describes the status changes when the application starts a replication, and when the application is being backgrounded or foregrounded by the OS. It applies to iOS only.
Additionally, on iOS, an app already in the background may be terminated. In this case, the `Database` and `Replicator` instances will be `null` when the app returns to the foreground. Therefore, as preventive measure, it is recommended to do a `null` check when the app enters the foreground, and to re-initialize the database and replicator if any of those is `null`.
810
814
@@ -964,7 +968,7 @@ By default, the WebSocket protocol uses compression to optimize for speed and ba
964
968
965
969
### Logs
966
970
967
-
As always, when there is a problem with replication, logging is your friend. You can increase the log output for activity related to replication with Sync Gateway — see [Example 21](#example-21-set-logging-verbosity).
971
+
As always, when there is a problem with replication, logging is your friend. You can increase the log output for activity related to replication with Sync Gateway - see [Example 21](#example-21-set-logging-verbosity).
968
972
969
973
#### Example 21. Set logging verbosity
970
974
@@ -986,15 +990,15 @@ For more on troubleshooting with logs, see: [Using Logs](../Troubleshooting/usin
986
990
987
991
### Authentication Errors
988
992
989
-
If Sync Gateway is configured with a self signed certificate but your app points to a `ws` scheme instead of `wss` you will encounter an error with status code 11006 — see: [Example 22](#example-22-protocol-mismatch)
993
+
If Sync Gateway is configured with a self signed certificate but your app points to a `ws` scheme instead of `wss` you will encounter an error with status code 11006 - see: [Example 22](#example-22-protocol-mismatch)
If Sync Gateway is configured with a self signed certificate, and your app points to a `wss` scheme but the replicator configuration isn’t using the certificate you will encounter an error with status code `5011` — see: [Example 23](#example-23-certificate-mismatch-or-not-found)
1001
+
If Sync Gateway is configured with a self signed certificate, and your app points to a `wss` scheme but the replicator configuration isn’t using the certificate you will encounter an error with status code `5011` - see: [Example 23](#example-23-certificate-mismatch-or-not-found)
998
1002
999
1003
#### Example 23. Certificate Mismatch or Not Found
> Description - _Quick reference for customer-facing changes in cbl-reactnative version 1.1_
9
+
> Related Content - [Release Notes](../../ProductNotes/release-notes.md) | [Using Logs](../../Troubleshooting/using-logs.md)
10
+
11
+
## At a Glance
12
+
13
+
Version 1.1 is focused on React Native New Architecture support and better troubleshooting:
14
+
15
+
1.**TurboModules** - iOS and Android modules now support the React Native New Architecture.
16
+
2.**Improved file logging** - React Native wrapper diagnostics can be written to file and custom log sinks.
17
+
3.**LogSinks.write()** - application code can write messages into configured Couchbase Lite log sinks.
18
+
4.**Reliability fixes** - listener cleanup, document expiration, and conflict-aware deletes are improved.
19
+
20
+
## TurboModule Support
21
+
22
+
Version 1.1 supports [React Native New Architecture](https://reactnative.dev/architecture/overview) through TurboModules. Existing application-level Couchbase Lite APIs remain largely compatible, but New Architecture should be enabled to use the TurboModule implementation.
23
+
24
+
For Expo development builds, enable New Architecture in `app.json`:
25
+
26
+
```json
27
+
{
28
+
"expo": {
29
+
"newArchEnabled": true
30
+
}
31
+
}
32
+
```
33
+
34
+
For React Native Android projects, make sure `newArchEnabled=true` is set in the Android project configuration.
35
+
36
+
## Logging Changes
37
+
38
+
### React Native Logs in File and Custom Sinks
39
+
40
+
When a file or custom log sink is enabled, version 1.1 can forward React Native wrapper diagnostics into the same logging pipeline as native Couchbase Lite logs.
41
+
42
+
React Native-originated lines are prefixed with `RN`:
43
+
44
+
```text
45
+
RN ::DEBUG:: database_Open
46
+
RN ::WARNING:: query_RemoveChangeListener rejected: no listener for token
47
+
RN ::ERROR:: collection_Save failed
48
+
```
49
+
50
+
This helps diagnose issues that cross the JavaScript/native boundary while keeping sensitive payloads out of forwarded logs.
51
+
52
+
### Writing Application Logs
53
+
54
+
Use `LogSinks.write()` to write application messages into configured Couchbase Lite sinks:
0 commit comments