DittoConnection
public struct DittoConnection
extension DittoConnection: Identifiable
extension DittoConnection: Equatable
extension DittoConnection: Hashable
extension DittoConnection: Codable
Represents a connection between two peers in a Ditto mesh network.
-
Unique identifier for the connection.
This ID is deterministic for any two peers and a given connection type.
Declaration
Swift
public var id: String
-
Type of transport enabling this connection.
Declaration
Swift
public var type: DittoConnectionType
-
The peer key of the peer at one end of the connection.
Declaration
Swift
@available(*, deprecated, message: "Use `peerKeyString1` instead.") public var peer1: Data { get set }
-
The peer key of the peer at the other end of the connection.
Declaration
Swift
@available(*, deprecated, message: "Use `peerKeyString2` instead.") public var peer2: Data { get set }
-
The peer key of the peer at one end of the connection, as a string.
The assignment to
peerKeyString1
andpeerKeyString2
is deterministic and stable for any two peers.Declaration
Swift
public var peerKeyString1: String
-
The peer key of the peer at the other end of the connection, as a string.
The assignment to
peerKeyString1
andpeerKeyString2
is deterministic and stable for any two peers.Declaration
Swift
public var peerKeyString2: String
-
Estimate of distance to the remote peer. This value is inaccurate. The environment, hardware, and several other factors can greatly affect this value. It is currently derived from RSSI.
Declaration
Swift
public var approximateDistanceInMeters: Double?
-
Initialize a new connection.
Declaration
Swift
@available(*, deprecated, message: "Use the variant taking peer key strings instead.") public init(id: String, type: DittoConnectionType, peer1: Data, peer2: Data, approximateDistanceInMeters: Double? = nil)
-
Initialize a new connection.
Declaration
Swift
public init(id: String, type: DittoConnectionType, peerKeyString1: String, peerKeyString2: String, approximateDistanceInMeters: Double? = nil)
-
Declaration
Swift
public func encode(to encoder: Encoder) throws
-
Declaration
Swift
public init(from decoder: Decoder) throws