Skip to main content

Application protocol providing Reactive Streams semantics

[object Object]

Why RSocket?

RSocket provides a protocol for Reactive Streams semantics between client-server, and server-server communication.

Motivations
[object Object]

What is RSocket?

RSocket is a binary protocol for use on byte stream transports such as TCP, WebSockets, and Aeron.

Protocol Spec
[object Object]

How do I use RSocket?

RSocket is intended to be consumed via one of the various implementation libraries which implement the RSocket Protocol.

Browse Libraries

Implementations

Drivers are assumed to implement all core features defined in the Protocol document.

Basic Examples

Server Example


RSocketServer.create(new PingHandler())
.payloadDecoder(PayloadDecoder.ZERO_COPY)
.bind(TcpServerTransport.create(7878))
.block()
.onClose();

Client Example


Mono<RSocket> client =
RSocketConnector.create()
.payloadDecoder(PayloadDecoder.ZERO_COPY)
.connect(TcpClientTransport.create(7878));

PingClient pingClient = new PingClient(client);

Recorder recorder = pingClient.startTracker(Duration.ofSeconds(1));

int count = 1_000;

pingClient
.requestResponsePingPong(count, recorder)
.doOnTerminate(() -> System.out.println("Sent " + count + " messages."))
.blockLast();

Introduction Video