Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 28 additions & 6 deletions sync/streams/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,14 @@ Sync Streams will be supported alongside Sync Rules for the foreseeable future,
* React hooks: v1.8.0
* Dart: v1.16.0
* Kotlin: v1.7.0
* .NET: v0.0.9-alpha.1
* Swift: [In progress](https://github.com/powersync-ja/powersync-swift/pull/86).
* Use of the [Rust-based sync client](https://releases.powersync.com/announcements/improved-sync-performance-in-our-client-sdks)
<Expandable title=" instructions">
* Use of the [Rust-based sync client](https://releases.powersync.com/announcements/improved-sync-performance-in-our-client-sdks). The Rust-based sync client is enabled by default on the latest version of all SDKs. If you are on a lower version, follow the instructions below to enable it.

<Expandable title="Instructions for enabling Rust client on lower SDK versions">
<Tabs>
<Tab title="JS">
In JavaScript SDKs, pass the `clientImplementation` option when connecting:
The Rust client became the default in Web SDK v1.32.0, React Native SDK v1.29.0, Node.js SDK v0.16.0, and Capacitor SDK v0.3.0. For lower versions, pass the `clientImplementation` option when connecting:

```js
await db.connect(new MyConnector(), {
Expand All @@ -61,7 +63,7 @@ Sync Streams will be supported alongside Sync Rules for the foreseeable future,
You can migrate back to the JavaScript client later by removing the option.
</Tab>
<Tab title="Dart">
Pass the `syncImplementation` option when connecting:
The Rust client became the default in Flutter/Dart SDK v1.17.0. Pass the `syncImplementation` option when connecting:

```dart
database.connect(
Expand All @@ -75,7 +77,7 @@ Sync Streams will be supported alongside Sync Rules for the foreseeable future,
You can migrate back to the Dart client later by removing the option.
</Tab>
<Tab title="Kotlin">
Pass the `newClientImplementation` option when connecting:
The Rust client became the default in Kotlin SDK v1.9.0. For lower versions, pass the `newClientImplementation` option when connecting:

```kotlin
//@file:OptIn(ExperimentalPowerSyncAPI::class)
Expand All @@ -87,7 +89,7 @@ Sync Streams will be supported alongside Sync Rules for the foreseeable future,
You can migrate back to the Kotlin client later by removing the option.
</Tab>
<Tab title="Swift">
Pass the `newClientImplementation` option when connecting:
The Rust client became the default in Swift SDK v1.8.0. For lower versions, pass the `newClientImplementation` option when connecting:

```swift
@_spi(PowerSyncExperimental) import PowerSync
Expand All @@ -99,6 +101,9 @@ Sync Streams will be supported alongside Sync Rules for the foreseeable future,

You can migrate back to the Swift client later by removing the option.
</Tab>
<Tab title=".NET">
The Rust client was introduced as the default in .NET SDK v0.0.5-alpha.1. No additional configuration is required.
</Tab>
</Tabs>
</Expandable>
* Sync Stream definitions. They are currently defined in the same YAML file as Sync Rules: `sync_rules.yaml` (PowerSync Cloud) or `config.yaml` (Open Edition/self-hosted). To enable Sync Streams, add the following configuration:
Expand Down Expand Up @@ -395,6 +400,23 @@ Select your language for specific examples:
```
</Tab>

<Tab title=".NET">
```csharp
var sub = await db.SyncStream("issues", new Dictionary<string, object> { { "id", "issue-id" } })
.Subscribe(new SyncStreamSubscribeOptions { Ttl = TimeSpan.FromHours(1) });

// Resolve current status for subscription
var status = db.CurrentStatus.ForStream(sub);
var progress = status?.Progress;

// Wait for this subscription to have synced
await sub.WaitForFirstSync();

// When the component needing the subscription is no longer active...
sub.Unsubscribe();
```
</Tab>

<Tab title="Swift - Coming soon">
Coming soon
</Tab>
Expand Down