Ditto 4.13.1
Loading...
Searching...
No Matches
DittoSDK.DittoConfig Class Reference

A configuration object for initializing a Ditto instance. More...

Public Member Functions

 DittoConfig (string databaseId, DittoConfigConnect connect, string persistenceDirectory=null)
 Initializes a new instance of the DittoConfig class.

Properties

static DittoConfig Default [get]
 Gets a default DittoConfig instance with standard settings.
static string DefaultDatabaseId [get]
 Gets the default identifier for a Ditto instance.
string DatabaseId [get, set]
 Gets or sets the unique identifier for the Ditto database.
DittoConfigConnect Connect [get, set]
 Gets or sets the connectivity configuration for this Ditto instance.
string PersistenceDirectory [get, set]
 Gets or sets the persistence directory used by Ditto to persist data.

Detailed Description

A configuration object for initializing a Ditto instance.

DittoConfig encapsulates all the parameters required to configure a Ditto instance, including identity, connectivity, persistence, and experimental features.

Important: This API is in preview and will become the standard way to initialize Ditto instances in v5, replacing the legacy DittoIdentity-based initialization.

Property Documentation

◆ Connect

DittoConfigConnect DittoSDK.DittoConfig.Connect
getset

Gets or sets the connectivity configuration for this Ditto instance.

Specifies how this instance discovers and connects to peers, including network settings and authentication options.

◆ DatabaseId

string DittoSDK.DittoConfig.DatabaseId
getset

Gets or sets the unique identifier for the Ditto database.

This must be a valid UUID string. You can find the Database ID in the Ditto portal, or provide your own if you only need to sync with a small set of peers.

"Database ID" was previously referred to as "App ID" in older versions of the SDK.

◆ Default

DittoConfig DittoSDK.DittoConfig.Default
staticget

Gets a default DittoConfig instance with standard settings.

This is useful as a starting point or for quickly creating a basic configuration, but for production use you should customize the configuration as needed.

◆ DefaultDatabaseId

string DittoSDK.DittoConfig.DefaultDatabaseId
staticget

Gets the default identifier for a Ditto instance.

This identifier is used when no explicit Database ID is provided. It is typically a constant UUID string that ensures a predictable default value. In most cases, you should provide your own unique identifier to avoid conflicts when syncing with other peers.

◆ PersistenceDirectory

string DittoSDK.DittoConfig.PersistenceDirectory
getset

Gets or sets the persistence directory used by Ditto to persist data.

This property accepts the following types of values:

  • Absolute path: A full file system path, such as /Users/joe/some/path/to/my-project.ddb.
  • Relative path: A path relative to Ditto.DefaultRootDirectory, such as some/path/to/my-project.ddb.
  • null: Ditto will use a default path of the form ditto-{database-id} inside Ditto.DefaultRootDirectory, where {database-id} is the lowercase Ditto database ID specified in the configuration.

To obtain the final, resolved absolute path being used after the Ditto instance is created, use Ditto.AbsolutePersistenceDirectory.

Note: "Database ID" was previously referred to as "App ID" in older versions of the SDK.

It is not recommended to directly read from or write to this directory, as its structure and contents are managed by Ditto and may change in future versions.

When DittoLogger is enabled, logs may be written to this directory even after the Ditto instance has been disposed. Refer to the DittoLogger documentation for more details.

See also
Ditto.AbsolutePersistenceDirectory, Ditto.DefaultRootDirectory