-
Notifications
You must be signed in to change notification settings - Fork 75
fix: [Capacitor] use HTTP NDJSON streaming as default #940
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
ca94c91
fix: use text streaming on iOS
stevensJourney c55c507
make http the default connection method if using capacitor community …
stevensJourney 0997ba6
add warning
stevensJourney f6c9a50
Merge branch 'main' into capacitor-ios-stream
stevensJourney 6bc0256
simplify checks
stevensJourney 1766f83
cleanup
stevensJourney 8d0b8bd
Merge branch 'main' into capacitor-ios-stream
stevensJourney 8818366
delete duplicate changeset
stevensJourney File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@powersync/capacitor': patch | ||
| --- | ||
|
|
||
| The `PowerSyncDatabase.connect` method now defaults to using NDJSON-HTTP as the connection method when using the Capacitor Community SQLite driver. This avoids slow binary processing present in Capacitor Community SQLite and should significantly increase sync performance on native platforms. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 0 additions & 22 deletions
22
packages/capacitor/src/sync/CapacitorBucketStorageAdapter.ts
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| import { WebRemote } from '@powersync/web'; | ||
|
|
||
| export class CapacitorRemote extends WebRemote { | ||
| protected get supportsStreamingBinaryResponses(): boolean { | ||
| /** | ||
| * We'd like to avoid passing Binary buffers to SQLite when using | ||
| * iOS and Android for now. This is due to inefficient binary processing. | ||
| * Syncing using Buffers and Capacitor Community SQLite has been observed to be notably | ||
| * slower than the NDJSON option. | ||
| * Capacitor Community SQLite serializes Buffer objects, which causes slowdown | ||
| * ios: https://github.com/capacitor-community/sqlite/blob/f507a1e779688ea72b9d7e8744c647f7b688c568/ios/Plugin/CapacitorSQLite.swift#L888-L912 | ||
| * android: https://github.com/capacitor-community/sqlite/blob/master/android/src/main/java/com/getcapacitor/community/database/sqlite/SQLite/UtilsSQLite.java#L141-L147 | ||
| * As a rough guideline, the time to locally sync 10_000 small records was observed as: | ||
| * iOS: | ||
| * - NDJSON: 449ms | ||
| * - Binary: 68_982ms | ||
| * Android: | ||
| * - NDJSON: 452ms | ||
| * - Binary: 1_847ms | ||
| */ | ||
| return false; | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.