CBLMessageEndpointConnection

@protocol CBLMessageEndpointConnection <NSObject>

ENTERPRISE EDITION ONLY.

The protocol implemented by the application using a custom transporation method to exchange replication data between peers.

  • Called to open a remote connection to the other peer when the replicator starts or when the CBLMessageEndpointListener accepts the connection. When the remote connection is established, call the completion block to acknowledge the completion.

    Declaration

    Objective-C

    - (void)open:(nonnull id<CBLReplicatorConnection>)connection
        completion:(nonnull void (^)(BOOL, CBLMessagingError *_Nullable))completion;

    Parameters

    connection

    The replicator connection.

    completion

    The completion block.

  • Called to close the remote connection with the other peer when the replicator stops or when the CBLMessageEndpointListener closes the connection. When the remote connection is closed, call the completion block to acknowledge the completion.

    Declaration

    Objective-C

    - (void)close:(nullable NSError *)error
        completion:(nonnull void (^)(void))completion;

    Parameters

    error

    The error if available.

    completion

    The completion block.

  • Called to send the replication data to the other peer. When the replication data is sent, call the completion block to acknowledge the completion.

    Declaration

    Objective-C

    - (void)send:(nonnull CBLMessage *)message
        completion:(nonnull void (^)(BOOL, CBLMessagingError *_Nullable))completion;

    Parameters

    message

    The message.

    completion

    The completion block.