DittoPeer

public struct DittoPeer
extension DittoPeer: Equatable
extension DittoPeer: Hashable
extension DittoPeer: Codable

Represents a peer in a Ditto mesh network.

  • Address to contact this peer via Ditto Bus.

    Declaration

    Swift

    public var address: DittoAddress
  • The peer key is a unique identifier for a given peer, equal to or derived from the cryptographic public key used to authenticate it.

    NOTE: This will be be empty when a peer is not updated to the latest version of the SDK.

    Declaration

    Swift

    @available(*, deprecated, message: "Use `peerKeyString` instead.")
    public var peerKey: Data { get set }
  • The peer key is a unique identifier for a given peer, equal to or derived from the cryptographic public key used to authenticate it.

    NOTE: This will be be empty when a peer is not updated to the latest version of the SDK.

    Declaration

    Swift

    public var peerKeyString: String
  • Currently active connections of the peer.

    Declaration

    Swift

    public var connections: [DittoConnection]
  • The human-readable device name of the remote peer. This defaults to the hostname but can be manually set by the application developer of the other peer. It is not necessarily unique.

    Declaration

    Swift

    public var deviceName: String
  • Indicates whether the peer is connected to Ditto Cloud.

    Declaration

    Swift

    public var isConnectedToDittoCloud: Bool
  • An optional Query Overlap Group which can be assigned to group certain types of peers together and configure relative connection priorities. Defaults to 0 if not set.

    Declaration

    Swift

    @available(*, deprecated, message: "Query overlap groups have been phased out, this property always returns 0.")
    public var queryOverlapGroup: UInt8 { get set }
  • os

    Undocumented

    Declaration

    Swift

    public var os: String?
  • The Ditto SDK version the peer is running with.

    Declaration

    Swift

    public var dittoSDKVersion: String?
  • Indicates whether the peer is compatible with the current peer.

    Declaration

    Swift

    public var isCompatible: Bool?
  • Metadata associated with the peer, empty dictionary by default.

    Use DittoPresence.setPeerMetadata(_:) or DittoPresence.setPeerMetadataJSONData(_:) to set this value.

    Peer metadata is dynamic and may change over the lifecycle of the DittoPresenceGraph. It may be empty when a remote peer initially appears in the presence graph and will be updated once the peer has synced its metadata with the local peer.

    See also

    DittoPresence.peerMetadata for details on usage of metadata.

    Declaration

    Swift

    public var peerMetadata: [String : Any?] { get }
  • Metadata associated with the peer by the identity service.

    Use an authentication webhook to set this value. See Ditto’s online documentation for more information on how to configure an authentication webhook.

    Declaration

    Swift

    public var identityServiceMetadata: [String : Any?] { get }
  • Initializes a new peer.

    Declaration

    Swift

    @available(*, deprecated, message: "Use `peerKeyString` variant instead.")
    public init(address: DittoAddress, peerKey: Data, connections: [DittoConnection], deviceName: String, isConnectedToDittoCloud: Bool, queryOverlapGroup: UInt8, os: String? = nil, dittoSDKVersion: String? = nil, isCompatible: Bool? = nil, peerMetadata: [String : AnyHashable?] = [:], identityServiceMetadata: [String : AnyHashable?] = [:])
  • Initializes a new peer.

    Declaration

    Swift

    @available(*, deprecated, message: "Use the version without `queryOverlapGroup` instead.")
    public init(address: DittoAddress, peerKeyString: String, connections: [DittoConnection], deviceName: String, isConnectedToDittoCloud: Bool, queryOverlapGroup: UInt8, os: String? = nil, dittoSDKVersion: String? = nil, isCompatible: Bool? = nil, peerMetadata: [String : Any?] = [:], identityServiceMetadata: [String : Any?] = [:])
  • Initializes a new peer.

    Declaration

    Swift

    public init(address: DittoAddress, peerKeyString: String, connections: [DittoConnection], deviceName: String, isConnectedToDittoCloud: Bool, os: String? = nil, dittoSDKVersion: String? = nil, isCompatible: Bool? = nil, peerMetadata: [String : Any?] = [:], identityServiceMetadata: [String : Any?] = [:])

Codable

  • Declaration

    Swift

    public func encode(to encoder: Encoder) throws
  • Declaration

    Swift

    public init(from decoder: Decoder) throws