Now it's not possible to output ByteBuf to browser with data from RSocket, gRPC or other Netty based RPC frameworks with Spring WebFlux, and you should convert ByteBuf to ByteBuffer. Any consideration to support ByteBuf directly. Maybe performance enhancement without convert, and API friendly.

   @GetMapping(value = "/bytebuf", produces = {MediaType.APPLICATION_JSON_VALUE})
    public Mono<ByteBuf> byteBuf() {
          //data from RSocket payload
    }

Comment From: smsufyian

I am willing to work on this issue

Comment From: poutsma

Not sure if a codecs is the proper place for this, as I am not sure what they would do in scenario's where ByteBuf is not available (i.e. WebFlux on Servlet). Also, there are workarounds:

For extracting a ByteBuf, you can easily cast to a NettyDataBuffer, and call getNativeBuffer(). To create a DataBuffer from a ByteBuf, use wrap.

Comment From: rstoyanchev

Typically in a Spring application, with WebClient or RSocketRequester, what you'll have is DataBuffer instead but if what you have is ByteBuf then we should be able to adapt. I can imagine ByteBufEncoder that wraps with NettyDataBufferFactory, or otherwise copy to ByteBuffer and wrap, and release the ByteBuf. A matching Decoder would make sense too and would be a simple pass-through.

Scheduling tentatively for 5.3 M1 but with a PR, we could probably include it sooner.

Comment From: encircled

Looks like s-m-sufyian is not working on it so I took it :)

Comment From: rstoyanchev

Superseded by #24866.