2

I am completely new to RSocket.

I read the FAQ and the motiviations page (and skimmed the Protocol page) and understand that RSocket can be used on top of TCP, WebSocket and Aeron. But what I don't understand is what the differences are between using RSocket with these transports because all interaction-models can be used with each transport.

I am personally interested in using RSocket channel to enable bi-directional communication but don't know which transport I should use. For example what are the differences between RSocket (channel) + TCP and RSocket (channel) + WebSocket?

I couldn't find an answer anywhere, so I was hoping someone here could help me out.

Ty in advance.

Martin Thompson
  • 1,341
  • 8
  • 11
RatManMan
  • 63
  • 6

2 Answers2

1

RSocket provides a common programming interface to multiple transports. You can choose the transport based on the qualities of service the transport provides. For example, if you require ease of firewall traversal then choose WebSocket, if you require low-latency and high-throughput transfer choose Aeron. All things are relative. Aeron can traverse firewalls but configuration is more specialised and WebSocket can give reasonable performance but it is not in the same category as Aeron.

Many other factors come into play so you need to understand the underlying transports with the qualities they provide and match these up against your requirements.

Martin Thompson
  • 1,341
  • 8
  • 11
  • So the choice doesn't have anything to do with RSocket. You have to look at what the transports bring to the table? WebSocket = WS I still don't really understand the difference between RSocket + TCP and RSocket and WS. I thought that the main difference between TCP and WS is the fact that WS enables bidirectional communication. But RSocket also brings that feature, even when TCP is used. WS als uses TCP so you'd say that using RSocket with TCP is faster (better?) than using RSocket with WS because you skip an extra layer. So what is the difference between RSocket + TCP and RSocket + WS? – RatManMan Apr 30 '21 at 12:03
  • RSocket with TCP or Aeron is a better fit for server to server comms, and RSocket with WebSocket is better for server to browser comms. – Martin Thompson Apr 30 '21 at 18:59
  • Could you explain why this is the case, or point me in the right direction? I don't know a lot about these things (network protocols?) and would like to learn about it but don't know where to start. Ty for your answers btw! – RatManMan May 01 '21 at 10:08
  • Most browsers are behind a firewall that will only allow HTTP which is used to initiate a websocket. – Martin Thompson May 04 '21 at 12:47
1

RSocket let's you program across platforms (JS, iOS, Android, C++ Server) with a single reactive network programming model. Cleanly supporting common reactive operations from frameworks like RxJava (Observable, Flowable, Single, Maybe, Completable).

The underlying transport is an implementation detail. But it's a critical implementation detail as between a mobile and a server hosted in GCP, WebSocket may be the only viable option. While in a datacenter you may opt for Aeron or TCP depending on your requirements.

Whatever you choose, you can write against the same higher level model of reactive network operations. If you know you just need say Aeron for a single server to server operation, you may not need RSocket, you could program directly against Aeron. RSocket is giving you this abstraction above it.

Yuri Schimke
  • 12,435
  • 3
  • 35
  • 69
  • Ty for answering! What do you mean exactly with: "let's you program across platforms with a single reactive programming model" ? Do you mean that RSocket provides a standard API that can be used on different platforms (browser, java server, etc) in order to communicate with other platforms? (from browser to java server for example) – RatManMan May 01 '21 at 10:15
  • Yep. Basically that. For your question how you intend to use it and with which clients is very relevant to the optimal choice – Yuri Schimke May 01 '21 at 10:17
  • And you say that even though choosing the right transport is important, it doesn't matter from a developers perspective because RSocket provides the same reactive features no matter which transport is used? Maybe this is a stupid question but how do you then choose the right transport? I for example am planning to have an RSocket java server in AWS that communicates bidirectionally with a browser. So could you maybe give an example of requirements for using WebSocket or TCP? – RatManMan May 01 '21 at 10:20
  • Use websocket. Browser and cloud providers both support websocket . Demo.rsocket.io shows this case – Yuri Schimke May 01 '21 at 10:27
  • I totally forgot to look at what browsers supported for some reason... You can't use Aeron or TCP directly in the browser, i think. Do you know if this is true? – RatManMan May 01 '21 at 10:32