@@ -34,7 +34,22 @@ public struct ConnectOptions {
34
34
/// ]
35
35
/// ```
36
36
public var params : JsonParam
37
+
38
+ /// Uses a new sync client implemented in Rust instead of the one implemented in Kotlin.
39
+ ///
40
+ /// The new client is more efficient and will become the default in the future, but is still marked as experimental for now.
41
+ /// We encourage interested users to try the new client.
42
+ @_spi ( PowerSyncExperimental)
43
+ public var newClientImplementation : Bool
37
44
45
+ /// The connection method used to connect to the Powersync service.
46
+ ///
47
+ /// The default method is ``ConnectionMethod/http``. Using ``ConnectionMethod/webSocket(_:)`` can
48
+ /// improve performance as a more efficient binary protocol is used. However, using the websocket connection method
49
+ /// requires enabling ``ConnectOptions/newClientImplementation``.
50
+ @_spi ( PowerSyncExperimental)
51
+ public var connectionMethod : ConnectionMethod
52
+
38
53
/// Initializes a `ConnectOptions` instance with optional values.
39
54
///
40
55
/// - Parameters:
@@ -49,9 +64,32 @@ public struct ConnectOptions {
49
64
self . crudThrottle = crudThrottle
50
65
self . retryDelay = retryDelay
51
66
self . params = params
67
+ self . newClientImplementation = false
68
+ self . connectionMethod = . http
69
+ }
70
+
71
+ /// Initializes a ``ConnectOptions`` instance with optional values, including experimental options.
72
+ @_spi ( PowerSyncExperimental)
73
+ public init (
74
+ crudThrottle: TimeInterval = 1 ,
75
+ retryDelay: TimeInterval = 5 ,
76
+ params: JsonParam = [ : ] ,
77
+ newClientImplementation: Bool = false ,
78
+ connectionMethod: ConnectionMethod = . http,
79
+ ) {
80
+ self . crudThrottle = crudThrottle
81
+ self . retryDelay = retryDelay
82
+ self . params = params
83
+ self . newClientImplementation = newClientImplementation
84
+ self . connectionMethod = connectionMethod
52
85
}
53
86
}
54
87
88
+ @_spi ( PowerSyncExperimental)
89
+ public enum ConnectionMethod {
90
+ case http
91
+ case webSocket
92
+ }
55
93
56
94
/// A PowerSync managed database.
57
95
///
0 commit comments