DITPresenceGraph

@interface DITPresenceGraph : NSObject <NSCopying>

Represents the Ditto mesh network of peers and their connections between each other. The localPeer is the entry point, all others are remote peers known by the local peer (either directly or via other remote peers).

  • Returns the local peer (usually the peer that is represented by the currently running Ditto instance). The localPeer is the entry point, all others are remote peers known by the local peer (either directly or via other remote peers).

    Declaration

    Objective-C

    @property (nonatomic, copy, readonly) DITPeer *_Nonnull localPeer;
  • Returns all remote peers known by the localPeer, either directly or via other remote peers.

    Declaration

    Objective-C

    @property (nonatomic, copy, readonly) NSArray<DITPeer *> *_Nonnull remotePeers;
  • Decodes passed in CBOR and initializes the presence graph with the resulting dictionary representation. Raises an NSInvalidArgumentException if CBOR couldn’t be decoded or the dictionary representation is not a valid presence graph representation.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithCBOR:(nonnull NSData *)cbor;
  • Initializes the presence graph with the passed in dictionary representation. Raises an NSInvalidArgumentException if the dictionary representation is not a valid presence graph.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithDictionaryRepresentation:
        (nonnull NSDictionary *)dictionaryRepresentation;
  • Initializes the presence graph with the passed in localPeer and an array of all remote peers.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithLocalPeer:(nonnull DITPeer *)localPeer
                                  remotePeers:
                                      (nonnull NSArray<DITPeer *> *)remotePeers;
  • Unavailable

    Undocumented

    Declaration

    Objective-C

    - (instancetype)init NS_UNAVAILABLE;
  • Returns a dictionary with all connections found in this graph by their IDs.

    Declaration

    Objective-C

    - (nonnull NSDictionary<NSString *, DITConnection *> *)allConnectionsByID;
  • Undocumented

    Declaration

    Objective-C

    - (NSUInteger)hash;
  • Undocumented

    Declaration

    Objective-C

    - (BOOL)isEqual:(nullable id)object;
  • Undocumented

    Declaration

    Objective-C

    - (BOOL)isEqualToPresenceGraph:(DITPresenceGraph *)presenceGraph;
  • Undocumented

    Declaration

    Objective-C

    - (DITPeer *)copy;
  • Undocumented

    Declaration

    Objective-C

    - (DITPeer *)copyWithZone:(nullable NSZone *)zone;