public interface DuplexConnection extends Availability, Closeable
Disposable.Composite, Disposable.Swap
Modifier and Type | Method and Description |
---|---|
ByteBufAllocator |
alloc()
Returns the assigned
ByteBufAllocator . |
default double |
availability() |
Flux<ByteBuf> |
receive()
Returns a stream of all
Frame s received on this connection. |
SocketAddress |
remoteAddress()
Return the remote address that this connection is connected to.
|
void |
sendErrorAndClose(RSocketErrorException errorException)
Send an error frame and after it is successfully sent, close the connection.
|
void |
sendFrame(int streamId,
ByteBuf frame)
Delivers the given frame to the underlying transport connection.
|
dispose, isDisposed
void sendFrame(int streamId, ByteBuf frame)
streamId
- to which the given frame relatesframe
- with the encoded contentvoid sendErrorAndClose(RSocketErrorException errorException)
errorException
- to encode in the error frameFlux<ByteBuf> receive()
Frame
s received on this connection.
Completion
Returned Publisher
MUST never emit a completion event (Subscriber.onComplete()
).
Error
Returned Publisher
can error with various transport errors. If the underlying
physical connection is closed by the peer, then the returned stream from here MUST
emit an ClosedChannelException
.
Multiple Subscriptions
Returned Publisher
is not required to support multiple concurrent subscriptions.
RSocket will never have multiple subscriptions to this source. Implementations MUST
emit an IllegalStateException
for subsequent concurrent subscriptions, if they do not
support multiple concurrent subscriptions.
Frame
s received.ByteBufAllocator alloc()
ByteBufAllocator
.ByteBufAllocator
SocketAddress remoteAddress()
SocketAddress
varies by transport type and should be downcast to obtain more detailed
information. For TCP and WebSocket, the address type is InetSocketAddress
. For
local transport, it is io.rsocket.transport.local.LocalSocketAddress
.default double availability()
availability
in interface Availability