2 sounds better to me, and will be faster most likely.  

On Monday, January 9, 2017 at 6:11:49 PM UTC-8, Francis Chuang wrote:
>
> I am looking into using grpc for communication between microservices using 
> the grpc-go library, because of the reasons outlined here: 
> http://www.grpc.io/docs/guides/concepts.html
>
> However, rather than using protobuf as the codec, I want to use graphql as 
> callers can define the shape of the response and only fetch the things they 
> need.
>
> I have thought of 2 options:
> 1. Use protobufs to wrap graphql/json. Requests will contain the graphql 
> query, variables and the queryname. Responses will just contain a result 
> field containing serialized JSON. This method allows me to use existing 
> tooling and code generation, but the double encoding bothers me.
>
> 2. Create a custom codec (https://godoc.org/google.golang.org/grpc#Codec) 
> to decode and encode requests and responses in JSON. This seems like the 
> best and cleanest way, but no code generation.
>
> What are your thoughts?
>
> Cheers,
> Francis
>

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/6a119b1a-c41f-4b1d-b5dd-15ed4ce079a4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to