Getting Started

The Vanilla RSocket getting started guide overviews key concepts and patterns that you will encounter when working with the various language specific RSocket reference implementations.

Dependencies#

Each language specific RSocket reference implementation requires a number of different dependencies. While these dependencies will differ between the various language specific reference implementations, many common patterns are shared amongst them.

// build.gradle
repositories {
mavenCentral()
maven { url 'https://repo.spring.io/milestone' } // Reactor milestones (if needed)
}
dependencies {
implementation 'io.rsocket:rsocket-core:1.1.0'
implementation 'io.rsocket:rsocket-transport-netty:1.1.0'
}

Connectors (Clients)#

Connectors are the primary method for connecting an RSocket Client to an RSocket Server. Each connector implementation is geared towards supporting one of the various transports as described in the transports protocol.

The below examples demonstrate creating a RSocket Connector in various languages using the WebSocket transport.

WebsocketClientTransport ws = WebsocketClientTransport.create(
URI.create("ws://rsocket-demo.herokuapp.com/ws"));
RSocket clientRSocket = RSocketConnector
.connectWith(ws)
.block();
info

RSocket has been designed for and tested with TCP, WebSocket, Aeron, and HTTP/2 streams as transport protocols.

Servers#

TODO

Working with Payloads (data & metadata)#

Payloads represent the concept of passing data back and forth between an RSocket Client and an RSocket Server, with a distinction between data and metadata. If we were to relate these concepts to HTTP, then data would represent the HTTP response/request body, and metadata would describe the HTTP request/response headers.

A single RSocket payload is capable of containing both data as well as metadata, and each can leverage different encodings. For example, an RSocket payload could encode its data as JSON (application/json), and its metadata as protobuf (application/vnd.google.protobuf).

note

It is most common for data and metadata to leverage the same encoding, but is not required.

Specifying Encoding#

Encoding for the data/metadata frames in an RSocket payload can be specified when the RSocket Client or RSocket Server is created.

@Bean
public RSocket rSocket() {
Mono<RSocket> source = RSocketConnector.create()
.metadataMimeType("message/x.rsocket.composite-metadata.v0")
.dataMimeType("application/json")
.connect(TcpClientTransport.create("localhost", 7000));
return RSocketClient.from(source);
}

Composite Metadata#

TODO

Request routing#

TODO

Tracing#

TODO

Authentication Metadata#

TODO

Getting Started with RSocket RPC#

Dependency Setup#

TODO

Code Generation#

TODO

Reactive API#

TODO

Single#

TODO

Flowable#

TODO

Project Reactor#

TODO

Tutorials#

TODO

Chat App#

TODO

Last updated on by Kevin Viglucci