fullstorydev / grpchan

Channels for gRPC: custom transports

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Code gen

opened this issue · comments

This in process grpc looks really nice. I found this via the issue in the main grpc repo.

What's the story with cross language usage though. At the moment the client must be another golang client ?

I am looking to use this with dart / flutter. Dart has an officially supported grpc package. Easy to find

Then I can use grpc to define my API between flutter and golang which both run in the same process

I am guessing this is really stretch what grpc in process is currently designed for.

Btw you have seen grpc-web by improbable on GitHub ?
Has a gopherjs client for it too.

The in-process channel in this repo is pure Go and uses Go channels to communicate between client and server components. So it is only suitable for Go clients and servers. In that respect, it is similar to the in-process transport provided by the gRPC Java library, which only works when both client and server are Java (since they run in the same JVM).

To use an in-process channel in Dart, there would need to be a Dart implementation of an in-process channel or transport (which one really depends on the abstractions exposed by the language-specific gRPC runtime library; for example, the Go gRPC library provides no transport abstraction).

Sharing/marshalling data structures across multiple garbage-collected runtimes in the same process seems perilous. Since the data layout for protobuf data structures will differ between language runtimes, you can't realistically directly share in-memory structures -- so you will need to actually serialize/de-serialize anyway. For your case, I think you'd be better off having them use normal/out-of-process gRPC, but you could eliminate some of the network stack and also have a secure channel without using TLS by having the client and server use a Unix socket, instead of a TCP socket.