DittoTransportConfig

public struct DittoTransportConfig : Codable, Equatable

A configuration object specifying which network transports Ditto should use to sync data.

A Ditto object comes with a default transport configuration where all available peer-to-peer transports are enabled. You can customize this by initializing a DittoTransportConfig, adjusting its properties, and supplying it to setTransportConfig() on Ditto.

When you initialize a DittoTransportConfig yourself it starts with all transports disabled. You must enable each one directly.

Peer-to-peer transports will automatically discover peers in the vicinity and create connections without any configuration. These are configured inside the peerToPeer property. To turn each one on, set its enabled property to true.

To connect to a peer at a known location, such as a Ditto Big Peer, add its address inside the connect configuration. These are either “host:port” strings for raw TCP sync, or a “wss://…” URL for WebSockets.

The listen configurations are for specific less common data sync scenarios. Please read the documentation on the Ditto website for examples. Incorrect use of listen can result in insecure configurations.

  • Configuration relating to peer-to-peer transports, which create connections automatically.

    Declaration

    Swift

    public var peerToPeer: DittoPeerToPeer
  • Configuration for connections to specific remote peers.

    Declaration

    Swift

    public var connect: DittoConnect
  • Configuration for receiving incoming connections.

    Declaration

    Swift

    public var listen: DittoListen
  • Settings not associated with any specific type of transport.

    Declaration

    Swift

    public var global: DittoGlobalConfig
  • Enable all supported peer-to-peer modes for this platform.

    Declaration

    Swift

    public mutating func enableAllPeerToPeer()
  • Enable/disable all supported peer-to-peer modes for this platform at once.

    Declaration

    Swift

    public mutating func setAllPeerToPeer(enabled: Bool)
  • Undocumented

    Declaration

    Swift

    public init()