DittoExperimental

public class DittoExperimental

Upcoming SDK features made available for prototyping.

Warning

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.
  • Undocumented

    Declaration

    Swift

    public class func busFor(ditto: Ditto) -> DittoBus
  • 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.

    Warning

    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.

    Declaration

    Swift

    public class func setMeshRole(meshRole: UInt8, ditto: Ditto)

    Parameters

    meshRole

    The mesh role for this peer. Must be between 0 and 63 (inclusive). Defaults to 0 if not set.

    ditto

    The Ditto instance which should inherit the role.

  • 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 transport config (DittoGlobalConfig) for more info. In general, you should start with mesh roles as they offer more control than sync groups.

    Warning

    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.

    Declaration

    Swift

    public class func setPriority(_ priority: DittoConnectionPriority, forMeshRole meshRole: UInt8, ditto: Ditto)

    Parameters

    priority

    The priority with which outgoing connections should be attempted.

    meshRole

    The mesh role of any remote peers to which we should not attempt to connect. Must be between 0 and 63 (inclusive).

    ditto

    The local Ditto instance.