MessageEndpointConnection

public protocol MessageEndpointConnection : AnyObject

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 MessageEndpointListener accepts the connection. When the remote connection is established, call the completion block to acknowledge the completion.

    Declaration

    Swift

    func open(connection: ReplicatorConnection, completion: @escaping (_ success: Bool, _ error: MessagingError?) -> Void)

    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 MessageEndpointListener closes the connection. When the remote connection is closed, call the completion block to acknowledge the completion.

    Declaration

    Swift

    func close(error: Error?, completion: @escaping () -> Void)

    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

    Swift

    func send(message: Message, completion: @escaping (_ success: Bool, _ error: MessagingError?) -> Void)

    Parameters

    message

    The message.

    completion

    The completion block.