What is the difference between RSocket + TCP and RSocket + WebSocket?

1.3k Views Asked by At

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.

2

There are 2 best solutions below

5
On BEST ANSWER

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.

4
On

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.