Replies: 3 comments 8 replies
-
What is the point of offering an API to implement gRPC clients and servers, rather than directly supporting gRPC clients and servers via the Deno CLI? |
Beta Was this translation helpful? Give feedback.
-
I'm currently working on modernizing our HTTP implementation to live on top of Hyper 1.0 and refactoring this code pretty significantly. gRPC will be next on my list, so I'll make sure that we're in a good place to support trailers/etc, at least on the |
Beta Was this translation helpful? Give feedback.
-
@mmastrac That's fantastic. Ultimately it would be ideal for new libraries with great backing and momentum like https://github.com/bufbuild/connect-es to be able to utilize this functionality in a similar mechanism to other integrations (fastify, nodejs vanilla http2 server, etc)! |
Beta Was this translation helpful? Give feedback.
-
We don't have a proper way to use gRPC protocol with Deno right now.
gRPC uses HTTP2 trailer for sending
grpc-status
, which is important for implementing gRPC. However, since Deno tries to provide Web-compatible interfaces, APIs likefetch
andDeno.serveHttp
do not provide any ways to read or write HTTP2 trailers.It is also undesirable to use FFI for gRPC. Native gRPC libraries like Tonic will have to be run in executors like Tokio, but Deno's own Tokio event loop is not exposed. So they can't be run in tandem with Deno, as otherwise they will block Deno.
It is possible to use
Deno.connectTls
andDeno.listenTls
to build entire HTTP2 and gRPC stack with JS. But it is hard to leverage HTTP2 implementation of Deno and would result in a performance decrease.So I propose to add new runtime APIs for
Deno.connectGrpc
andDeno.listenGrpc
, as follows.This is arguably a lower level API (or too high to someone. I wanted to make the interface simple). But we necessarily need this general design because gRPC supports not only Protobuf but also other serialization formats like FlatBuffers.
I would expect that higher-level API is to be provided by codegen layers like Pbkit as Protobuf already requires codegen anyway.
Beta Was this translation helpful? Give feedback.
All reactions