Hey, I’m investigating grpc implementation and fou...
# kotlinx-rpc
y
Hey, I’m investigating grpc implementation and found a pretty big limitation:
Copy code
Kotlin: Multiple parameters are not allowed in @Grpc service functions.
Any plans to serialize multiple parameters as a single grpc message?
I mean for no proto mode
a
Hi! Can you specify your use-case please?
y
any method with multiple arguments like:
Copy code
suspend fun findAll(
        filter: BuyerFilter,
        pageParams: PageParams,
    ): PageResult<Buyer>
a
Well, this is not a well-defined behavior from the gRPC standpoint We are already stretching the boundaries of regular usage here with the proto-less interfaces
I'll what we can do, but no promises for now, it is a low priority
y
definitely, it will not lay well on the protocol, but people that use krpc with no proto mode do not care about idiomatic usage of the protocol, there are multiple possible workarounds like double serialization (like you did in ktor rpc, field with bytes) or synthetic class
it’s kinda one of the main usecases of the lib IMO, being able to use kotlin interfaces as a contract and currently it’s not supported
👍🏻 1
a
with no proto mode do not care about idiomatic usage of the protocol
I wouldn't say this is the best approach to do things
y
not for the sake of argument, just explained my problem, thank you
🙌 1
a
it’s kinda one of the main usecases of the lib IMO, being able to use kotlin interfaces as a contract and currently it’s not supported
it is fair for kRPC, but not for gRPC. gRPC is for using gRPC in KMP, and playing by the gRPC rules. We can make it nicer where we can, but still respecting the gRPC conventions and rules kRPC, on the other hand, is to be Kotlin-first, yes, and I would love to see it shine too. But we have to prioritize things now, and kRPC is waiting for its turn for now
y
hm… if rpc-grpc module is intended to be a gRPC SDK first then maybe we can try to integrate gRPC transport into kRPC instead? why I’m pushing for this: I already have http2 protocol, that is decent, but I still have a big overhead from serialization and service messages (handshakes, backpressure, etc), that I cannot simply disable/replace without rewriting the core of the lib
a
gRPC is generally considered to be quite fast protocol, what overhead do you have? Also, making gRPC is kRPC will make the problem force in overhead, not better
y
gRPC is generally considered to be quite fast protocol, what overhead do you have?
that’s what I’m saying, it’s faster and more robust than http protocol in kRPC, main overhead of your own protocol is service messages, especially given the fact I’m creating new connection on every request
a
Exactly. That's a part of why we are doing gRPC. We can bring a good wire protocol for free, with a good Kotlin DX. It's not Kotlin-first DX in every aspect, and it has its limitations by design, but this is sufficient in most cases. As for the multiple params, we will think what can be done there
y
cool, thanks