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 void
close()
void
close(MessagingError error)
Tells the replicator to close the current replicator connection.void
receive(Message message)
Tells the replicator to consume the data received from the other peer.String
toString()
-
-
-
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:
toString
in classC4NativePeer
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
-
receive
public final void receive(@NonNull Message message)
Description copied from interface:ReplicatorConnection
Tells the replicator to consume the data received from the other peer.- Specified by:
receive
in interfaceReplicatorConnection
- Parameters:
message
- the message
-
close
public final void close(@Nullable MessagingError error)
Description copied from interface:ReplicatorConnection
Tells 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:
close
in interfaceReplicatorConnection
- Parameters:
error
- the error if any
-
-