Class MessageSocket
- java.lang.Object
-
- com.couchbase.lite.internal.core.C4NativePeer
-
- com.couchbase.lite.internal.core.C4Socket
-
- com.couchbase.lite.internal.replicator.MessageSocket
-
- All Implemented Interfaces:
ReplicatorConnection,AutoCloseable
public class MessageSocket extends C4Socket implements ReplicatorConnection
This class should be re-implemented using the paradigms described in C4Socket and AbstractCBLWebSocket. It should be re-architected to use a single-threaded executor. It might need to be a state machine.
-
-
Field Summary
-
Fields inherited from class com.couchbase.lite.internal.core.C4Socket
NO_FRAMING, WEB_SOCKET_CLIENT_FRAMING, WEB_SOCKET_SERVER_FRAMING
-
-
Constructor Summary
Constructors Constructor Description MessageSocket(long peer, MessageEndpoint endpoint)MessageSocket(MessageEndpointConnection connection, ProtocolType protocolType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidclose(MessagingError error)Tells the replicator to close the current replicator connection.voidreceive(Message message)Tells the replicator to consume the data received from the other peer.StringtoString()
-
-
-
Constructor Detail
-
MessageSocket
public MessageSocket(@NonNull MessageEndpointConnection connection, @NonNull ProtocolType protocolType)
-
MessageSocket
public MessageSocket(long peer, @NonNull MessageEndpoint endpoint)
-
-
Method Detail
-
toString
@NonNull public String toString()
- Overrides:
toStringin classC4NativePeer
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable
-
receive
public final void receive(@NonNull Message message)Description copied from interface:ReplicatorConnectionTells the replicator to consume the data received from the other peer.- Specified by:
receivein interfaceReplicatorConnection- Parameters:
message- the message
-
close
public final void close(@Nullable MessagingError error)Description copied from interface:ReplicatorConnectionTells the replicator to close the current replicator connection. In return, the replicator will call the MessageEndpointConnection's close(error, completion) to acknowledge the closed connection.- Specified by:
closein interfaceReplicatorConnection- Parameters:
error- the error if any
-
-