RSocket

Application protocol providing Reactive Streams semantics

Spec | TCK | C++ | Java | Javascript | Wireshark | CLI

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

It enables the following symmetric interaction models via async message passing over a single connection:

It supports session resumption, to allow resuming long-lived streams across different transport connections. This is particularly useful for mobile<->server communication when network connections drop, switch, and reconnect frequently.

Detailed information can be found in these documents:

Following is a brief example of a server and client in C++:

Example C++ server:

  // RSocket server accepting on TCP
  auto rs = RSocket::createServer(TcpConnectionAcceptor::create(FLAGS_port));
  // global request handler
  auto handler = std::make_shared<HelloStreamRequestHandler>();
  // start accepting connections
  rs->startAndPark([handler](auto r) { return handler; });

Example C++ client:

  auto rsf = RSocket::createClient(
      TcpConnectionFactory::create(FLAGS_host, FLAGS_port));

  auto rs = rsf->connect().get();
  auto flowable = rs->requestStream(Payload("Jane"));
  flowable->subscribe(createSubscriber<std::string>(
          [](auto t) { std::cout << t << std::endl; }));