Top Description Methods
io.rsocket

public Interface DuplexConnection

extends Availability, Closeable
Known Direct Implementers
io.rsocket.core.ClientServerInputMultiplexer.InternalDuplexConnection, io.rsocket.core.LoggingDuplexConnection, io.rsocket.core.SetupHandlingDuplexConnection, io.rsocket.internal.BaseDuplexConnection, io.rsocket.resume.ResumableDuplexConnection, io.rsocket.resume.ResumableDuplexConnection.DisposedConnection
Imports
io.netty.buffer.ByteBuf, .ByteBufAllocator, java.net.SocketAddress, java.nio.channels.ClosedChannelException, org.reactivestreams.Subscriber, reactor.core.publisher.Flux

Represents a connection with input/output that the protocol uses.

Method Summary

Modifier and TypeMethod and Description
public ByteBufAllocator

Returns:

the ByteBufAllocator
alloc
()

Returns the assigned ByteBufAllocator.

public default double
public Flux<ByteBuf>

Returns:

Stream of all Frames received.
receive
()

Returns a stream of all Frames received on this connection.

public SocketAddress

Returns:

the address
remoteAddress
()

Return the remote address that this connection is connected to.

public void
sendErrorAndClose(RSocketErrorException
to encode in the error frame
errorException
)

Send an error frame and after it is successfully sent, close the connection.

public void
sendFrame(int
to which the given frame relates
streamId
,
ByteBuf
with the encoded content
frame
)

Delivers the given frame to the underlying transport connection.

Inherited from io.rsocket.Closeable:
onClose

Method Detail

allocback to summary
public ByteBufAllocator alloc()

Returns the assigned ByteBufAllocator.

Returns:ByteBufAllocator

the ByteBufAllocator

availabilityback to summary
public default double availability()

Implements io.rsocket.Availability.availability.

Returns:double

Doc from io.rsocket.Availability.availability.

a positive numbers representing the availability of the entity. Higher is better, 0.0 means not available

Annotations
@Override
receiveback to summary
public Flux<ByteBuf> receive()

Returns a stream of all Frames 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.

Returns:Flux<ByteBuf>

Stream of all Frames received.

remoteAddressback to summary
public SocketAddress remoteAddress()

Return the remote address that this connection is connected to. The returned SocketAddress varies by transport type and should be downcast to obtain more detailed information. For TCP and WebSocket, the address type is java.net.InetSocketAddress. For local transport, it is io.rsocket.transport.local.LocalSocketAddress.

Returns:SocketAddress

the address

Since
1.1
sendErrorAndCloseback to summary
public void sendErrorAndClose(RSocketErrorException errorException)

Send an error frame and after it is successfully sent, close the connection.

Parameters
errorException:RSocketErrorException

to encode in the error frame

sendFrameback to summary
public void sendFrame(int streamId, ByteBuf frame)

Delivers the given frame to the underlying transport connection. This method is non-blocking and can be safely executed from multiple threads. This method does not provide any flow-control mechanism.

Parameters
streamId:int

to which the given frame relates

frame:ByteBuf

with the encoded content