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: client-sdk-references/javascript-web.mdx
+50-58Lines changed: 50 additions & 58 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -285,62 +285,55 @@ See [Usage Examples](/client-sdk-references/javascript-web/usage-examples) for f
285
285
286
286
## Developer Notes
287
287
288
-
### Connecting via WebSocket or HTTP Stream
288
+
### Connection Methods
289
289
290
-
This SDK connects to a PowerSync instance and streams sync commands via WebSockets (enabled by default since @powersync/[email protected]) or HTTP streaming.
290
+
This SDK supports two methods for streaming sync commands:
291
291
292
-
The WebSocket implementation uses reactive socket streams from the cross-platform [RSocket](https://github.com/powersync-ja/powersync-js/pull/rsocket.io) library. This allows the client to request commands from the server after processing existing events, alleviating any back-pressure build-up of commands. Sync commands are transmitted as BSON (binary) documents.
292
+
1. **WebSocket (Default)**
293
+
- The implementation leverages RSocket for handling reactive socket streams.
294
+
- Back-pressure is effectively managed through client-controlled command requests.
295
+
- Sync commands are transmitted efficiently as BSON (binary) documents.
296
+
- This method is **recommended** since it will support the future [BLOB column support](https://roadmap.powersync.com/c/88-support-for-blob-column-types) feature.
293
297
294
-
#### Benefits of using the WebSocket Method
298
+
2. **HTTP Streaming (Legacy)**
299
+
- This is the original implementation method.
300
+
- This method will not support the future BLOB column feature.
295
301
296
-
* BLOB column support will be added on top of the WebSocket implementation (the HTTP streaming method will not support this).
297
-
298
-
#### Selecting Connection Method
299
-
300
-
The `PowerSyncDatabase` client's `connect` method supports a `connectionMethod` option. This is not required, as the WebSocket method is used by default.
302
+
By default, the `PowerSyncDatabase.connect()` method uses WebSocket. You can optionally specify the `connectionMethod` to override this:
### Configuring Different SQLite Virtual Filesystems for Web
311
-
The default SQLite VFS (`IDBBatchAtomicVFS`) can be replaced by supported [OPFS](https://developer.mozilla.org/en-US/docs/Web/API/File_System_API/Origin_private_file_system) alternatives.
312
-
`IDBBatchAtomicVFS` uses `IndexedDB` as the underlying storage which may have worse performance and stability issues with browsers such as Safari when compared with `OPFS` based VFSs.
313
-
See the [WA-SQLite README](https://github.com/powersync-ja/wa-sqlite/blob/1bb58d3619b96a2708e0320e1c22d0f2b9db35c6/src/examples/README.md#L28) for more details on each option.
312
+
### SQLite Virtual File Systems
314
313
315
-
`OPFS` can be configured with a `WASQLiteOpenFactory`.
314
+
This SDK supports multiple Virtual File Systems (VFS), responsible for storing the local SQLite database:
@@ -350,58 +343,57 @@ export const db = new PowerSyncDatabase({
350
343
}
351
344
});
352
345
```
353
-
</CodeGroup>
354
346
355
-
**Note**: The `AccessHandlePoolVFS` does not to work correctly in the multiple tabs use case. `OPFSCoopSyncVFS` works with multiple tabs, and adds multiple tab support for both Safari and Safari iOS.
347
+
##### AccessHandlePoolVFS
348
+
- This implementation delivers optimal performance for single-tab applications.
349
+
- The system is not designed to handle multiple tab scenarios.
350
+
- The configuration is similar to `OPFSCoopSyncVFS`, but requires using `WASQLiteVFS.AccessHandlePoolVFS`.
351
+
352
+
#### VFS Compatibility Matrix
356
353
357
-
**Note**: There are known limitations with `OPFS` in Safari’s incognito mode, which may cause it to not function properly.
354
+
| VFS Type | Multi-Tab Support (Standard Browsers) | Multi-Tab Support (Safari/iOS) | Notes |
| **IDBBatchAtomicVFS** | Supported | Not supported | May have stability issues on Safari. |
362
-
| **AccessHandlePoolVFS**| Not supported | Not supported | Does not work correctly in multi-tab scenarios. |
363
-
| **OPFSCoopSyncVFS** | Supported | Supported | Works with multiple tabs on all browsers, including Safari. |
360
+
**Note**: There are known issues with OPFS when using Safari's incognito mode.
364
361
365
-
### Clearing OPFS Storage
362
+
### Managing OPFS Storage
366
363
367
-
Clearing `OPFS` storage isn’t as straightforward as clearing `IndexedDB` which can be done through browser developer tools.
368
-
This requires developers to manually iterate through and delete files and directories.
364
+
Unlike IndexedDB, OPFS storage cannot be managed through browser developer tools. The following utility functions can help you manage OPFS storage programmatically:
Copy file name to clipboardExpand all lines: client-sdk-references/react-native-and-expo.mdx
+14-14Lines changed: 14 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -370,27 +370,27 @@ See [Usage Examples](/client-sdk-references/react-native-and-expo/usage-examples
370
370
371
371
## Developer Notes
372
372
373
-
### Connecting via WebSockets or HTTP Streams
373
+
### Connection Methods
374
374
375
-
This SDK connects to a PowerSync instance and streams sync commands via WebSockets (enabled by default since @powersync/[email protected]) or HTTP streams.
375
+
This SDK supports two methods for streaming sync commands:
376
376
377
-
The WebSocket implementation (available since version 1.4.6 of the SDK) uses reactive socket streams using the cross-platform [RSocket](https://github.com/powersync-ja/powersync-js/pull/rsocket.io) library. This allows the client to request commands from the server after processing existing events, alleviating any back-pressure build-up of commands. Sync commands are transmitted as BSON (binary) documents.
377
+
1. **WebSocket (Default)**
378
+
- The implementation leverages RSocket for handling reactive socket streams.
379
+
- Back-pressure is effectively managed through client-controlled command requests.
380
+
- Sync commands are transmitted efficiently as BSON (binary) documents.
381
+
- This method is **recommended** since it will support the future [BLOB column support](https://roadmap.powersync.com/c/88-support-for-blob-column-types) feature.
378
382
379
-
#### Benefits of using the WebSocket Method
383
+
2. **HTTP Streaming (Legacy)**
384
+
- This is the original implementation method.
385
+
- This method will not support the future BLOB column feature.
380
386
381
-
* BLOB column support will be added on top of the WebSocket implementation (the HTTP streaming method will not support this).
382
-
* If you are using Expo \<v51, then you no longer need to disable the [Flipper debug tools](/client-sdk-references/react-native-and-expo#android-flipper-network-plugin-for-http-streams) (this is required for HTTP streaming to work in debug Android builds).
383
-
* In internal testing, the WebSocket method was slightly faster than the HTTP streaming method on React Native.
384
-
385
-
#### Selecting Connection Method
386
-
387
-
The `PowerSyncDatabase` client's `connect` method supports a `connectionMethod` option. This is not required, as the WebSocket method is used by default.
387
+
By default, the `PowerSyncDatabase.connect()` method uses WebSocket. You can optionally specify the `connectionMethod` to override this:
0 commit comments