Rsocket features


i start learn rsocket and i have some issues:

  1. what does mean playlad ZERO_COPY
  2. in server side what the effect of method onClose()
  3. when server intercept client connect who server can know ip (dns) of client
  4. what does mean resumeSessionDuration
  5. its possible in server-side to broadcast payload to all clients connected
  6. if server send stream (requestStream) to client, and close (dispose) the client still receive data after server disposed
  7. how simule ‘resumption’ with simple demo

Hi Halim,

Great to see you’re checking RSocket out.

  1. When you receive a payload in rsocket-java by default it copies the data and metadata fields when creating a payload. Coping the data has a performance cost, but it is easier because you do not have to manage the payload’s lifecycle. If you want higher performance (and it can be significantly higher) - you can use zero copy. Instead of copying the incoming payload rsocket-java hands you the raw bytes as they come in from the network - the data isn’t copied. If you do this you must manage the life cycle of the payload. If you do not you will get memory leaks.

  2. The onClose() method returns a Mono that completes when the server closes. You can subscribe to this if are interested in performaning an action when RSocket closes

  3. RSocket isn’t tied to IP - for instance we use it with shared memory - so that information isn’t available right now. Although this has been asked for a couple times so maybe we could add some metadata when something connects

  4. See #7 - Maksym can help out here

  5. There is no mechanism in the protocol to multi-cast directly. If you stored all the incoming RSockets from your socket accept in someplace however that you could find then you could all them all in. You could also use Netif’s broker ( - it has built-in broadcasting and will do this for you.

  6. All frames are emitted in order - if you there are on_next frames emitted before a cancel then the client will process them until the cancel frame arrives

  7. @mostroverkhov can help you with resumption



resumeSessionDuration is interval during which resumption may happen after disconnect. Resumption of expired resumable connection is impossible.

Transport disconnects may be emulated with proxy or tools like socat - byte streams forwarder.
For example, if start it with socat -d TCP-LISTEN:8001,fork,reuseaddr TCP:localhost:8000, then server can bind on 8000 port, and client can connect 8001. Stop / start socat in terminal for emulating disconnects - demo is available at resumable file transfer example


in point (1) if don’t use ZERO_COPY so what the goal of retain payload and how manage this payload copies in both client/server side ?

in point (6) when server accept connection from client its register this socket & initial payload and pass them to acceptor handler (ConnectionSetupPayload, RSocket) so i try to to register each cleint connection in list, when server is disconnect (onclose subscription) i looping on this list and close its connection and i work fine, so in server-side these a queue for rsocket client ? and if true how to manage it (size and memory) ??


i see the example, so resumeSessionDuration (in minute) vs PeriodicResumeStrategy(in second) if i understand : the sever resume session (restart in minutes) however client try to resume connection to server in seconds ?? library accepts java Duration - minutes for session duration, and seconds for reconnect interval are used for demo purposes

yes i know i just want to confirm the idea of resumption