https://kotlinlang.org logo
#squarelibraries
Title
# squarelibraries
t

Tianyu Zhu

09/28/2023, 9:37 PM
Is it possible to create a
com.squareup.wire.GrpcClient
in Kotlin/JS?
j

jessewilson

09/29/2023, 2:41 AM
Nothing exists currently
b

Benoit Quenaudon

09/29/2023, 10:07 AM
The client is now open (abstract) though, so you’re able to implement it yourself
t

Tianyu Zhu

10/06/2023, 8:18 PM
I wrote some code that seems to work (?) but I'm no expert on coroutines. @jessewilson / @Benoit Quenaudon / anyone, would you care to take a look? https://gist.github.com/tianyu/36ecf8e5a2a936f008ea61f97e04abc0
b

Benoit Quenaudon

10/07/2023, 7:50 AM
Are you sure ktor can do duplex calls?
t

Tianyu Zhu

10/07/2023, 3:24 PM
@Benoit Quenaudon ktor does not support full duplex. Here's what I think is feasible: • Supported: Single message in, single message out. • Supported: Single message in, streaming messages out. • Supported (maybe?): Streaming messages in, single message out. • Not supported: Full duplex. ◦ Supported (maybe?): Streaming all messages in before streaming all messages out. In general, I think we can support any communication pattern where the entire request is sent before any response is expected. Unsurprisingly, we won't be able to support "conversational" communication patterns where requests and responses are sent concurrently. However, it's exciting that we might be able to support a wider variety of rpcs than the grpc-web project!
b

Benoit Quenaudon

10/07/2023, 6:57 PM
What I would suggest is for you to test your implementation within Wire for the tests we have in https://github.com/square/wire/tree/master/wire-grpc-tests/src/test/java/com/squareup/wire Check where you can replace the GrpcClient implementation with your own and see how it goes.
3 Views