Skip to content

Commit 44d5e88

Browse files
feat: default to newClientImplementation (#97)
1 parent 6ed7103 commit 44d5e88

File tree

4 files changed

+33
-6
lines changed

4 files changed

+33
-6
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Changelog
22

3+
## 1.8.0 (unreleased)
4+
5+
* Enable the `newClientImplementation` by default. This should improve performance and memory usage.
6+
* **Potential Breaking Change** The `newClientImplementation` now uses WebSockets to connect to the PowerSync service. These WebSockets connections do not log events to `SyncClientConfiguration->requestLogger`.
7+
* Add the `soft` flag to `disconnectAndClear()` which keeps an internal copy of synced data in the database, allowing faster re-sync if a compatible token is used in the next connect() call
8+
* Update PowerSync SQLite core to 0.4.10
9+
* Update Kotlin SDK to 1.7.0.
10+
11+
312
## 1.7.0
413

514
* Update Kotlin SDK to 1.7.0.

Demo/PowerSyncExample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 10 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Sources/PowerSync/Protocol/PowerSyncDatabaseProtocol.swift

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,17 +90,21 @@ public struct ConnectOptions: Sendable {
9090
self.crudThrottle = crudThrottle
9191
self.retryDelay = retryDelay
9292
self.params = params
93-
newClientImplementation = false
93+
newClientImplementation = true
9494
self.clientConfiguration = clientConfiguration
9595
}
9696

9797
/// Initializes a ``ConnectOptions`` instance with optional values, including experimental options.
98-
@_spi(PowerSyncExperimental)
98+
@available(
99+
*,
100+
deprecated,
101+
message: "Specifying the newClientImplementation flag is no longer needed. It is now enabled by default. The use of the old client is deprecated and will be removed in a future version."
102+
)
99103
public init(
100104
crudThrottle: TimeInterval = 1,
101105
retryDelay: TimeInterval = 5,
102106
params: JsonParam = [:],
103-
newClientImplementation: Bool = false,
107+
newClientImplementation: Bool = true,
104108
clientConfiguration: SyncClientConfiguration? = nil
105109
) {
106110
self.crudThrottle = crudThrottle
@@ -311,11 +315,11 @@ public extension PowerSyncDatabaseProtocol {
311315
func disconnectAndClear() async throws {
312316
try await disconnectAndClear(clearLocal: true, soft: false)
313317
}
314-
318+
315319
func disconnectAndClear(clearLocal: Bool) async throws {
316320
try await disconnectAndClear(clearLocal: clearLocal, soft: false)
317321
}
318-
322+
319323
func disconnectAndClear(soft: Bool) async throws {
320324
try await disconnectAndClear(clearLocal: true, soft: soft)
321325
}

Tests/PowerSyncTests/ConnectTests.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,11 @@ final class ConnectTests: XCTestCase {
116116
try await database.connect(
117117
connector: TestConnector(url: fakeUrl),
118118
options: ConnectOptions(
119+
/// Note that currently, HTTP logs are only supported with the old client implementation
120+
/// which uses HTTP streams.
121+
/// The new client implementation uses a WebSocket connection instead.
122+
/// Which we don't get logs for currently.
123+
newClientImplementation: false,
119124
clientConfiguration: SyncClientConfiguration(
120125
requestLogger: SyncRequestLoggerConfiguration(
121126
requestLevel: .all

0 commit comments

Comments
 (0)