@@ -21,6 +21,7 @@ public sealed class DbConnectionBuilder<DbConnection>
2121 string ? token ;
2222 Compression ? compression ;
2323 bool light ;
24+ bool ? confirmedReads ;
2425
2526 public DbConnection Build ( )
2627 {
@@ -32,7 +33,7 @@ public DbConnection Build()
3233 {
3334 throw new InvalidOperationException ( "Building DbConnection with a null nameOrAddress. Call WithModuleName() first." ) ;
3435 }
35- conn . Connect ( token , uri , nameOrAddress , compression ?? Compression . Brotli , light ) ;
36+ conn . Connect ( token , uri , nameOrAddress , compression ?? Compression . Brotli , light , confirmedReads ) ;
3637#if UNITY_5_3_OR_NEWER
3738 if ( SpacetimeDBNetworkManager . _instance != null )
3839 {
@@ -72,6 +73,12 @@ public DbConnectionBuilder<DbConnection> WithLightMode(bool light)
7273 return this ;
7374 }
7475
76+ public DbConnectionBuilder < DbConnection > WithConfirmedReads ( bool confirmedReads )
77+ {
78+ this . confirmedReads = confirmedReads ;
79+ return this ;
80+ }
81+
7582 public delegate void ConnectCallback ( DbConnection conn , Identity identity , string token ) ;
7683
7784 public DbConnectionBuilder < DbConnection > OnConnect ( ConnectCallback cb )
@@ -99,7 +106,7 @@ public DbConnectionBuilder<DbConnection> OnDisconnect(DisconnectCallback cb)
99106
100107 public interface IDbConnection
101108 {
102- internal void Connect ( string ? token , string uri , string addressOrName , Compression compression , bool light ) ;
109+ internal void Connect ( string ? token , string uri , string addressOrName , Compression compression , bool light , bool ? confirmedReads ) ;
103110
104111 internal void AddOnConnect ( Action < Identity , string > cb ) ;
105112 internal void AddOnConnectError ( WebSocket . ConnectErrorEventHandler cb ) ;
@@ -184,7 +191,7 @@ protected DbConnectionBase()
184191 SpacetimeDBNetworkManager . _instance . RemoveConnection ( this ) ;
185192 }
186193 } ;
187-
194+
188195#if UNITY_WEBGL && ! UNITY_EDITOR
189196 if ( SpacetimeDBNetworkManager . _instance != null )
190197 SpacetimeDBNetworkManager . _instance . StartCoroutine ( ParseMessages ( ) ) ;
@@ -484,7 +491,22 @@ public void Disconnect()
484491 /// </summary>
485492 /// <param name="uri"> URI of the SpacetimeDB server (ex: https://testnet.spacetimedb.com)
486493 /// <param name="addressOrName">The name or address of the database to connect to</param>
487- void IDbConnection . Connect ( string ? token , string uri , string addressOrName , Compression compression , bool light )
494+ /// <param name="compression">The compression settings to use</param>
495+ /// <param name="light">Whether or not to request light updates</param>
496+ /// <param name="confirmedReads">
497+ /// If set to true, instruct the server to send updates for transactions
498+ /// only after they are confirmed to be durable.
499+ ///
500+ /// What durable means depends on the server configuration. In general,
501+ /// a transaction is durable when it has been written to disk on one or
502+ /// more servers.
503+ ///
504+ /// If set to false, instruct the server to send updates as soon as
505+ /// transactions are committed in memory.
506+ ///
507+ /// If not set, the server chooses the default.
508+ /// </param>
509+ void IDbConnection . Connect ( string ? token , string uri , string addressOrName , Compression compression , bool light , bool ? confirmedReads )
488510 {
489511 isClosing = false ;
490512
@@ -509,7 +531,7 @@ async Task Function()
509531 {
510532 try
511533 {
512- await webSocket . Connect ( token , uri , addressOrName , ConnectionId , compression , light ) ;
534+ await webSocket . Connect ( token , uri , addressOrName , ConnectionId , compression , light , confirmedReads ) ;
513535 }
514536 catch ( Exception e )
515537 {
@@ -879,8 +901,8 @@ void IDbConnection.Unsubscribe(QueryId queryId)
879901 /// Represents the result of parsing a database update message from SpacetimeDB.
880902 /// Contains updates for all tables affected by the update, with each entry mapping a table handle
881903 /// to its respective set of row changes (by primary key or row instance).
882- ///
883- /// Note: Due to C#'s struct constructor limitations, you must use <see cref="ParsedDatabaseUpdate.New"/>
904+ ///
905+ /// Note: Due to C#'s struct constructor limitations, you must use <see cref="ParsedDatabaseUpdate.New"/>
884906 /// to create new instances.
885907 /// Do not use the default constructor, as it will not initialize the Updates dictionary.
886908 /// </summary>
0 commit comments