Scrivio Interview library
ConceptFoundations7 min read · updated 12 November 2026

What is RSocket, what are its four interaction models, and how does Spring support it?

RSocket is a binary application protocol that multiplexes many independent streams over one connection, with Reactive Streams semantics, so each stream has backpressure, and it runs over TCP, WebSocket and other transports. Its four interaction models are request-response, fire-and-forget, request-stream and request-channel, where both sides stream. Spring supports it in spring-messaging with @MessageMapping handlers, the RSocketRequester client, Spring Boot auto-configuration such as spring.rsocket.server.port, and since Spring Framework 6 interface clients declared with @RSocketExchange.

Why this question is asked

Most services talk over HTTP, and when they need streaming they reach for WebSocket, server-sent events or gRPC. RSocket is a less familiar option, and interviewers bring it up to see whether we understand reactive communication beyond a single request and response: backpressure across the network, several streams on one connection, and either side starting a conversation. In this answer, we will recap what RSocket is and why it exists, go through its four interaction models with code, see how Spring and Spring Boot support it on the server and the client, and finish with an honest look at its adoption.

1A Quick Recap of What RSocket Is

RSocket is an application protocol, like HTTP, but designed for reactive, message-driven communication. It is binary, so every message is a compact frame rather than text. It is multiplexed, which means one connection carries many independent streams at the same time, each identified by a stream id, so a slow stream does not block the others. And it is symmetric: once connected, either side can send requests to the other, so a server can call back into a client over the same connection.

The most important feature is backpressure. Backpressure means the consumer tells the producer how much it is ready to receive. In RSocket this is part of the protocol: a request carries an initial demand, and the receiver sends REQUEST_N frames to ask for more. That is the Reactive Streams request(n) idea carried across the network, so a fast server cannot flood a slow client.

RSocket does not care what carries its frames. The common transports are TCP, for service-to-service traffic, and WebSocket, for browsers. Each message has data and metadata, and the metadata is where Spring puts the route that selects the handler, much as an HTTP path does.

2The Four Interaction Models

RSocket names four ways to interact, and each fits a different kind of call. Request-response sends one message and gets one back, like a normal HTTP call but without blocking a connection. Fire-and-forget sends one message and expects nothing back, which is cheaper than request-response when we do not need a reply, for example a metrics event. Request-stream sends one request and receives a stream of many responses, such as price updates for a symbol. Request-channel opens a stream in both directions, so the client sends a stream of messages and the server sends a stream back, for example a chat or a live game session.

RSocket interaction models
ModelClient sendsServer returnsTypical use
request-responseone messageMono<T>look up an account
fire-and-forgetone messagenothing (Mono<Void> locally)send a metrics event
request-streamone messageFlux<T>subscribe to price updates
request-channelFlux<T>Flux<R>chat, live sync in both directions

Notice that the models map directly onto the reactive types we already use in Spring: a Mono for one value, a Flux for many, and Mono<Void> when nothing comes back.

3Writing the Server Side in Spring

Spring's RSocket support lives in the spring-messaging module, and Spring Boot adds a starter, spring-boot-starter-rsocket. Setting spring.rsocket.server.port starts an RSocket server over TCP on that port. Handlers are methods on a @Controller annotated with @MessageMapping, and the route string in the annotation plays the part of the URL.

Java
@Controller
class QuoteController {
@MessageMapping("quote") // request-response
Mono<Quote> quote(String symbol) { return quotes.latest(symbol); }
@MessageMapping("audit") // fire-and-forget: void or Mono<Void>
Mono<Void> audit(AuditEvent e) { return auditLog.save(e).then(); }
@MessageMapping("quotes.{symbol}") // request-stream, route variable
Flux<Quote> stream(@DestinationVariable String symbol) {
return quotes.updates(symbol); // backpressure comes from the client's demand
}
@MessageMapping("orders.channel") // request-channel: a Flux in, a Flux out
Flux<Ack> channel(Flux<Order> orders) { return orders.flatMap(service::place); }
}
# application.properties
spring.rsocket.server.port=7000

Spring works out the interaction model from the method signature. A method that returns nothing is fire-and-forget when called that way, a single value or Mono is request-response, a Flux return is request-stream, and a Flux parameter with a Flux return is request-channel. Payloads are encoded and decoded with the configured codecs, CBOR and JSON by default in Spring Boot.

4Calling It From a Client

On the client side, Spring gives us RSocketRequester, a fluent client built on top of a connection. Spring Boot provides an RSocketRequester.Builder bean already configured with the codecs. We pick a route, give the data, and say which shape of answer we want.

Java
RSocketRequester requester = builder.tcp("localhost", 7000);
Mono<Quote> one = requester.route("quote").data("ACME").retrieveMono(Quote.class);
Mono<Void> sent = requester.route("audit").data(event).send(); // fire-and-forget
Flux<Quote> many = requester.route("quotes.{s}", "ACME").retrieveFlux(Quote.class);
Flux<Ack> acks = requester.route("orders.channel").data(orderFlux).retrieveFlux(Ack.class);
many.take(10).subscribe(q -> log.info("{}", q)); // only 10 quotes are requested over the wire

Since Spring Framework 6 there is also a declarative style, like the HTTP interface clients. We describe the remote service as a Java interface with @RSocketExchange methods, and RSocketServiceProxyFactory creates an implementation that uses an RSocketRequester underneath.

5Declarative Interface Clients With @RSocketExchange

The interface approach keeps the calling code free of routes and builder calls, and makes the remote service easy to mock in tests.

Java
interface QuoteClient {
@RSocketExchange("quote")
Mono<Quote> quote(String symbol);
@RSocketExchange("quotes.{symbol}")
Flux<Quote> stream(@DestinationVariable String symbol);
}
@Bean
QuoteClient quoteClient(RSocketRequester requester) {
return RSocketServiceProxyFactory.builder(requester).build().createClient(QuoteClient.class);
}
Step throughA request-stream with backpressure
ClientRSocket connectionServer handler
REQUEST_STREAM route quotes.ACME, initial demand 10
invoke stream("ACME")
10 PAYLOAD frames, one quote each
REQUEST_N 10: ready for more
10 more PAYLOAD frames
CANCEL when the client is done

6 messages in order. Play them, or step through them one at a time.

The server never sends more than the client has asked for.

So the same handler can be called either fluently or through an interface, and both go through the same connection with the same backpressure.

6Where RSocket Stands Today

RSocket is a well-designed protocol, but its adoption has stayed limited compared with gRPC, which has a large multi-language ecosystem, and with WebSocket and server-sent events, which every browser and proxy understands. Fewer load balancers, service meshes and observability tools understand RSocket frames, and fewer engineers have used it.

Spring's support has also changed across generations, so before choosing RSocket for a new system we should check the current support status in the release notes of the Spring Boot and Spring Framework versions we plan to use, and how active the RSocket Java project is. It remains a reasonable choice for a contained use case that needs bidirectional streams with backpressure, but it is rarely the default.

7Follow-up questions

How is RSocket different from WebSocket?

WebSocket is a transport: it gives us a full-duplex byte or text channel and nothing more, so we must invent our own message format, routing and flow control. RSocket is an application protocol that can run on top of WebSocket and adds the interaction models, multiplexed streams, routing metadata and backpressure.

How does RSocket compare with gRPC streaming?

Both multiplex streams on one connection and support streaming in both directions. gRPC runs over HTTP/2, uses Protobuf contracts and has broad language and tooling support. RSocket is transport-independent, symmetric so a server can call the client, and carries Reactive Streams demand explicitly. In practice gRPC is the safer choice for most teams because of its ecosystem.

What happens when the connection drops?

All streams on that connection end with an error. RSocket defines resumption, where a client can reconnect and resume streams from a position, and Spring lets us configure reconnect strategies on the requester, but the server keeps no durable record of messages. Anything that must survive a disconnect needs a durable system such as a message broker.

8Conclusion

In this answer, we saw that RSocket is a binary, multiplexed application protocol that brings Reactive Streams backpressure to the network and runs over TCP, WebSocket and other transports. Its four interaction models are request-response, fire-and-forget, request-stream and request-channel. Spring supports it in spring-messaging with @MessageMapping handlers, the RSocketRequester client and Spring Boot auto-configuration through spring.rsocket.server.port, and Spring Framework 6 added @RSocketExchange interface clients. We also saw that adoption is limited, so the current support status of our Spring Boot version should be checked before choosing it.

What to say in the interviewAbout 80 seconds aloud

Open with

RSocket is a binary application protocol for reactive communication. It multiplexes many streams over one connection, it is symmetric so either side can send requests, and it builds Reactive Streams backpressure into the protocol: the receiver sends request-n frames to ask for more, so a fast producer cannot overwhelm a slow consumer.

Then, if they want more

It runs over TCP between services or over WebSocket for browsers. It has four interaction models: request-response, one message in and one out; fire-and-forget, one message with no reply; request-stream, one request and a stream of responses; and request-channel, where both sides stream. In Spring it lives in spring-messaging.

On the server I write @MessageMapping methods on a controller, and the signature decides the model, Mono for one value and Flux for a stream. Spring Boot's RSocket starter starts a server when I set spring.rsocket.server.port.

On the client I use RSocketRequester with route, data, and retrieveMono, retrieveFlux or send, and since Spring Framework 6 I can declare an interface with @RSocketExchange and let RSocketServiceProxyFactory implement it.

I would add that adoption is limited compared with gRPC and WebSocket, so I would check the support status in the Spring Boot version I am using before betting a new system on it.

About this answer

Last updated
12 November 2026
Versions it names
Spring Framework 6
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "What is RSocket, what are its four interaction models, and how does Spring support it?": https://scrivio-interview-library.netlify.app/spring-boot/web-other/428b17f96f/