Ditto 1.1.6
Static Public Member Functions | List of all members
DittoSDK.DittoExperimental Class Reference

Upcoming SDK features made available for prototyping. More...

Static Public Member Functions

static DittoBus GetBus (Ditto ditto)
 
static unsafe void SetMeshRole (byte meshRole, Ditto ditto)
 Upcoming SDK feature made available for prototyping. More...
 
static unsafe void SetPriorityForMeshRole (DittoConnectionPriority priority, byte meshRole, Ditto ditto)
 Upcoming SDK feature made available for prototyping. More...
 

Detailed Description

Upcoming SDK features made available for prototyping.

Experimental functionality should not be used in production applications as it may be changed or removed at any time, and may not have the same security features.

Member Function Documentation

◆ SetMeshRole()

static unsafe void DittoSDK.DittoExperimental.SetMeshRole ( byte  meshRole,
Ditto  ditto 
)
inlinestatic

Upcoming SDK feature made available for prototyping.

Sets a mesh role for the local Ditto instance. Mesh roles are an optional feature used to group peers in a mesh based on their function and control which roles connect to others with which priority.

This function should be called before starting Ditto sync - or Ditto sync should be restarted if mesh roles are set at a later date.

Not all apps will require this functionality. In many apps, all peers are the same. These apps are better served by the automatic mesh which Ditto will form.

Mesh roles might be appropriate if your use case calls for connections between specific peers. For instance, a fast food ordering app might need to ensure that customer apps prioritize connections to restaurant kiosks rather than other customers so they can place their orders. In this example, all customer apps will receive one role (e.g. 1) and all kiosks will receive another (e.g. 2). Customer apps would be configured to treat kiosk peers as high-priority connection targets. Similar examples can be made for games in which one peer which is acting as the host server vs. other peers which are joining the game.

Mesh roles can also be used to prevent connections between peers of different roles. Peers of differing roles can be configured to regard each other with a "DONT_CONNECT" priority (see SetPriorityDontConnectForMeshRole for more info).

The numeric value for the mesh role is entirely use-case specific and you can define the values however you like - provided all peers agree on the meaning of the values. All peers belong to role 0 initially and will connect to each other with normal priority until specified otherwise.

Note: mesh roles are not a security mechanism. A peer may change its role at any time. Mesh roles are used only to influence the shape of the mesh which Ditto creates or to serve as targets for multihop sync.

Parameters
meshRoleThe mesh role for this peer. Must be between 0 and 63 (inclusive). Defaults to 0 if not set.
dittoThe Ditto instance which should inherit the role.

◆ SetPriorityForMeshRole()

static unsafe void DittoSDK.DittoExperimental.SetPriorityForMeshRole ( DittoConnectionPriority  priority,
byte  meshRole,
Ditto  ditto 
)
inlinestatic

Upcoming SDK feature made available for prototyping.

Configures the priority with which the local Ditto instance will connect to any remote peers of the given mesh role.

Connections can be established in either direction, so the remote peers might attempt connections to this Ditto with different priorities unless they are similarly configured.

While mesh roles offer the most flexibility in establishing connection priorities, a similar concept called "Sync Groups" exists. See the SyncGroup property in the global config (DittoGlobalConfig) for more info. In general, you should tart with mesh roles as they offer more control than sync groups.

Note: Mesh roles are not a security mechanism.A peer may change its role at runtime for any reason. Mesh roles are used only to influence the shape of the mesh which Ditto creates or to serve as targets for multihop sync.

Parameters
priorityThe priority with which outgoing connections should be attempted.
meshRoleThe mesh role of any remote peers to which we should not attempt to connect. Must be between 0 and 63 (inclusive).
dittoThe local Ditto instance.