CBLMultipeerReplicator
@interface CBLMultipeerReplicator : NSObject
A multipeer replicator that manages peer discovery, connection, and replication in multipeer mesh network.
-
The configuration.
Declaration
Objective-C
@property (nonatomic, copy, readonly) CBLMultipeerReplicatorConfiguration *_Nonnull config; -
The peer identifier represents this multipeer replicator instance.
Declaration
Objective-C
@property (nonatomic, readonly) CBLPeerID *_Nonnull peerID; -
A list of currently visible peer identifiers.
Warning
This property can block for several seconds in some cases. It is recommended to not access it on the UI thread. This is a known issue we plan to address in a future release.Declaration
Objective-C
@property (nonatomic, readonly) NSArray<CBLPeerID *> *_Nonnull neighborPeers; -
Initializes the multipeer replicator with the given configuration.
Declaration
Objective-C
- (nullable instancetype) initWithConfig:(nonnull CBLMultipeerReplicatorConfiguration *)config error:(NSError *_Nullable *_Nullable)error;Parameters
configThe configuration.
errorOn return, the error if any.
Return Value
An initialized replicator instance, or nil on failure.
-
Starts peer discovery and replication with connected peers.
Note
Once stopped, restarting is not currently supported.Declaration
Objective-C
- (void)start; -
Stops peer discovery and all active replicators.
Note
Once stopped, restarting is not currently supported.Declaration
Objective-C
- (void)stop; -
Returns information about a peer.
Warning
This method can block for several seconds in some cases. It is recommended to not call this on the UI thread. This is a known issue we plan to address in a future release.
Declaration
Objective-C
- (nullable CBLPeerInfo *)peerInfoForPeerID:(nonnull CBLPeerID *)peerID;Parameters
peerIDThe peer identifier.
Return Value
The peer info instance, or nil if the peer is unknown.
-
Returns the current status of the given transport, or nil if that transport is not enabled.
Warning
This method can block for several seconds in some cases. It is recommended to not call this on the UI thread. This is a known issue we plan to address in a future release.
Declaration
Objective-C
- (nullable CBLMultipeerReplicatorStatus *)statusForTransport:(id)transport;Parameters
transportThe transport to query for the status.
Return Value
The current status, or nil if the transport is not enabled.
-
Adds a listener for changes to the overall multipeer replicator status.
Declaration
Objective-C
- (nonnull id<CBLListenerToken>) addStatusListenerWithQueue:(nullable dispatch_queue_t)queue listener: (nonnull void (^)( CBLMultipeerReplicatorStatus *_Nonnull))listener;Parameters
queueThe dispatch queue for invoking the listener. If nil, the main queue is used.
listenerA block to receive status updates.
Return Value
A token for removing the listener.
-
Adds a listener for updates to peer discovery status.
Declaration
Objective-C
- (nonnull id<CBLListenerToken>) addPeerDiscoveryStatusListenerWithQueue:(nullable dispatch_queue_t)queue listener: (nonnull void (^)( CBLPeerDiscoveryStatus *_Nonnull)) listener;Parameters
queueThe dispatch queue for invoking the listener. If nil, the main queue is used.
listenerA block to receive discovery status updates.
Return Value
A token for removing the listener.
-
Adds a listener for replicator status updates for each connected peer.
Declaration
Objective-C
- (nonnull id<CBLListenerToken>) addPeerReplicatorStatusListenerWithQueue:(nullable dispatch_queue_t)queue listener: (nonnull void (^)( CBLPeerReplicatorStatus *_Nonnull)) listener;Parameters
queueThe dispatch queue for invoking the listener. If nil, the main queue is used.
listenerA block to receive per-peer replicator status updates.
Return Value
A token for removing the listener.
-
Adds a listener for document replication updates from each connected peer.
Declaration
Objective-C
- (nonnull id<CBLListenerToken>) addPeerDocumentReplicationListenerWithQueue:(nullable dispatch_queue_t)queue listener:(nonnull void (^)( CBLPeerDocumentReplication *_Nonnull))listener;Parameters
queueThe dispatch queue for invoking the listener. If nil, the main queue is used.
listenerA block to receive per-peer document replication updates.
Return Value
A token for removing the listener.
-
Unavailable
Not available.
Declaration
Objective-C
- (nonnull instancetype)init;
CBLMultipeerReplicator Class Reference