|
Ditto 5.0.0
|
The entrypoint to the Ditto SDK. More...
Public Member Functions | |
| void | SetOfflineOnlyLicenseToken (string licenseToken) |
| Activate an offline Ditto instance by setting a license token. You cannot sync with Ditto before you have activated it. The offline license token is only valid for DittoConfigConnect.SmallPeersOnly. | |
| void | UpdateTransportConfig (Action< DittoTransportConfigBuilder > configure) |
| Convenience method to update the current transport config of the receiver. | |
| Public Member Functions inherited from DittoSDK.Internal.Drop | |
| void | Dispose () |
| Suppresses finalization and initiates custom disposal logic. | |
Static Public Member Functions | |
| static Task< Ditto > | OpenAsync (DittoConfig config=null) |
| Asynchronously creates and returns a new Ditto instance using the provided configuration. | |
| static Ditto | Open (DittoConfig config=null) |
| Synchronously creates and returns a new Ditto instance using the provided configuration. | |
Protected Member Functions | |
| override void | Dispose (bool disposing) |
| Overload for types to dispose of resources, regardless of whether the type is being disposed or finalized. Note that finalization occurs on a dedicated thread. | |
| Protected Member Functions inherited from DittoSDK.Internal.Drop | |
| void | Dispose (bool disposing) |
| Overload for types to dispose of resources, regardless of whether the type is being disposed or finalized. Note that finalization occurs on a dedicated thread. | |
Properties | |
| static string | DefaultRootDirectory [get] |
| Gets the default root directory used for Ditto data persistence. | |
| static string | Version [get] |
| Gets a string containing the semantic version of the Ditto SDK. Example: 4.5.0. | |
| DittoConfig | Config [get, set] |
| Gets the configuration used to initialize this Ditto instance. | |
| bool | Activated [get] |
| Gets a value indicating whether or not the SDK has been activated. | |
| string | DeviceName [get, set] |
| Gets or sets a custom identifier for this peer. | |
| string | AbsolutePersistenceDirectory [get] |
| Gets the persistence directory used by Ditto to persist data, represented as an absolute path. | |
| DittoStore | Store [get] |
| Gets a reference to the embedded data store. | |
| DittoSync | Sync [get] |
| Gets the instance that provides access to the SDK's sync functionality. | |
| DittoPresence | Presence [get] |
| Gets a reference to the presence manager. | |
| DittoDiskUsage | DiskUsage [get] |
| Gets a reference to the disk usage. | |
| DittoAuthenticator | Auth [get] |
Gets a DittoAuthenticator that provides access to authentication information and methods for logging on to Ditto Server. | |
| DittoTransportConfig | TransportConfig [get, set] |
| Gets or sets the transport configuration. By default, peer-to-peer transports are enabled. | |
| DittoSmallPeerInfo | SmallPeerInfo [get] |
| Provides access to the SDK's small peer info functionality. | |
| Properties inherited from DittoSDK.Internal.Drop | |
| bool | IsDisposed [get] |
Events | |
| EventHandler< DittoAuthenticationRequestEventArgs > | DittoIdentityProviderAuthenticationRequest [add, remove] |
An optional EventHandler delegate that can be provided to respond to incoming authentication requests from peers who wish to join the Ditto mesh. Requires setup of signing and verification keys in the Http part of TransportConfig. | |
| EventHandler< DittoTransportConditionChangedEventArgs > | DittoTransportConditionChanged |
An optional EventHandler delegate that can be provided to get updates about events relating to changes in network transports. | |
The entrypoint to the Ditto SDK.
For a Ditto instance to continue to connect to other devices it must be kept in scope.
|
inlineprotected |
Overload for types to dispose of resources, regardless of whether the type is being disposed or finalized. Note that finalization occurs on a dedicated thread.
| disposing | true when invoked from an explicit Dispose() call. false when invoked from the finalizer. |
|
inlinestatic |
Synchronously creates and returns a new Ditto instance using the provided configuration.
This is a blocking convenience method for initializing Ditto, intended for use in non-async environments. The method will block the calling thread until the instance is ready or an error is thrown.
| config | The configuration to initialize the new Ditto instance with. Defaults to DittoConfig.Default. |
| DittoStoreException | Thrown with PersistenceDirectoryLocked if the chosen persistence directory is already in use by another Ditto instance. |
| DittoValidationException | Thrown with InvalidDittoConfig if the passed in config 's contents do not meet the required validation criteria. For detailed information on the validation requirements, consult the documentation of the individual properties of DittoConfig. |
| DittoException | May throw other DittoExceptions for other initialization failures. |
|
inlinestatic |
Asynchronously creates and returns a new Ditto instance using the provided configuration.
Important: In Ditto version 4.x, this method is only partially async and blocks for a significant portion of the initialization process. It will become fully async starting with Ditto 5.0.
| config | The configuration to initialize the new Ditto instance with. Defaults to DittoConfig.Default. |
| DittoStoreException | Thrown with PersistenceDirectoryLocked if the chosen persistence directory is already in use by another Ditto instance. |
| DittoValidationException | Thrown with InvalidDittoConfig if the passed in config 's contents do not meet the required validation criteria. For detailed information on the validation requirements, consult the documentation of the individual properties of DittoConfig. |
| DittoException | May throw other DittoExceptions for other initialization failures. |
|
inline |
Activate an offline Ditto instance by setting a license token. You cannot sync with Ditto before you have activated it. The offline license token is only valid for DittoConfigConnect.SmallPeersOnly.
| licenseToken | The license token to activate the Ditto instance with, which you can find on the Ditto portal (https://portal.ditto.live). |
| DittoException | Thrown if the provided license token is expired or invalid. |
|
inline |
Convenience method to update the current transport config of the receiver.
Invokes the lambda expression with a copy of the current transport config which you can alter to your liking. The updated transport config is then set upon the receiver.
You may use this method to alter the configuration at any time. Sync will not begin until DittoSync.Start() is invoked.
| configure | A delegate that receives a copy of the current DittoTransportConfig to modify. |
|
get |
Gets the persistence directory used by Ditto to persist data, represented as an absolute path.
The value returned by this property depends on what was specified in DittoConfig.PersistenceDirectory:
null was provided, the default path is used in the format: {defaultRoot}/ditto-{database-id}, where {defaultRoot} corresponds to Ditto.DefaultRootDirectory and {database-id} is the lowercase Ditto database ID. This property always returns a consistent, resolved absolute path for the lifetime of the Ditto instance, and it represents the actual directory being used for data persistence.
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. See the DittoLogger documentation for more information.
|
get |
Gets a value indicating whether or not the SDK has been activated.
If false then you need to call Ditto.SetOfflineOnlyLicenseToken(string) before interacting with the SDK.
|
getset |
Gets the configuration used to initialize this Ditto instance.
Note: Sensitive data such as passphrases and private keys are redacted from the returned configuration and replaced with the string [REDACTED].
|
staticget |
Gets the default root directory used for Ditto data persistence.
On iOS, Android or MacCatalyst targets, this returns the AppDataDirectory. On other platforms, it defaults to the current working directory (Environment.CurrentDirectory).
This value is used when a relative persistence directory path (or null) is provided in the configuration.
See also:
|
getset |
Gets or sets a custom identifier for this peer.
When using Presence.Observe(), each remote peer is represented by a short UTF-8 "device name". By default this will be a truncated version of the device's hostname.
Changes to this property after DittoSync.Start() was called will only take effect after the next restart of sync. The value does not need to be unique among peers. Device names longer than 24 bytes will be truncated once DittoSync.Start() is called.
|
getset |
Gets or sets the transport configuration. By default, peer-to-peer transports are enabled.
You may use this property to alter the configuration at any time; however, sync will not begin until DittoSync.Start() is called.
Important: Modifying any sub-property of the retrieved DittoTransportConfig (e.g., disabling Bluetooth via PeerToPeer.BluetoothLE.Enabled = false) will not apply the change automatically. To persist changes, you must either: