line / armeria

Your go-to microservice framework for any situation, from the creator of Netty et al. You can build any type of microservice leveraging your favorite technologies, including gRPC, Thrift, Kotlin, Retrofit, Reactive Streams, Spring Boot and Dropwizard.
https://armeria.dev
Apache License 2.0
4.81k stars 915 forks source link

RSocket support #3019

Open bsideup opened 4 years ago

bsideup commented 4 years ago

This is a meta issue for the https://rsocket.io support. RSocket is a binary protocol for use on byte stream transports such as TCP, WebSockets, and Aeron. It enables all modern communication models (request/response, request/stream, fire-and-forget, bi-directional streaming) without being tied to a concrete transport.

Unlike gRPC, it uses various transport options, but the TCP and WebSockets ones would be fitting Armeria very well and allow running it simultaneously with HTTP and gRPC on the same port (one of Ameria's greatest features if you ask me :))

For the RPC part, one can look at https://github.com/rsocket/rsocket-rpc-java - gRPC-like framework on top of RSocket.

OlegDokuka commented 4 years ago

Rsocket Core Dev here! I can help with anything that is needed from the RSocket side!

trustin commented 4 years ago

Thanks for creating this issue, @bsideup! +1 for having RSocket support, as well as WebSocket. We will need to figure out:

OlegDokuka commented 4 years ago

Hi @trustin!

And thank you soo much for your enthusiasm and openness for RSocket! I really appreciate that!

In general, RSocket frames have a pretty strict format, thus I guess it is possible to distinguish them checking layout. However, that approach can not be stable since reading the full frame to check its layout all the time (if it would be necessary for all the frames) can be expensive.

On the other hand, RSocket can work on top of WebSocket. That said, WebSocket can be mapped on some specific path of the HTTP server, so this can be used as an alternative to avoid frames checking all the way.

anuraaga commented 4 years ago

I didn't look in detail but it seems rsocket can work with HTTP/2 streams

https://rsocket.io/docs/Protocol#framing

In that case it seems like it would be quite easy to provide support in Armeria :) Is there no content type sent with HTTP/2? If not, is it possible to add it? I think that would address the negotiation issue perfectly.

OlegDokuka commented 4 years ago

@anuraaga I'm planning on adding http/2 support for 1.1, but it is not there yet

anuraaga commented 4 years ago

@OlegDokuka Ah saw it in the docs but I guess that means the protocol is defined, but not implemented yet.

I guess it's a race between Armeria implementing web socket support and rsocket implementing HTTP/2? :) Or perhaps even Armeria could be the first implementation of rsocket over http/2.

OlegDokuka commented 4 years ago

What is necessary to implement is the Transport API. The core logic is shared and is transport agnostic