Yes, you can do this!  You need to use a custom codec and use the native 
grpc API instead of the proto-generated one.  Example:

Codec definition (basically pass-through):
https://github.com/grpc/grpc-go/blob/master/benchmark/worker/main.go#L46

Install it in the client when dialing:
https://godoc.org/google.golang.org/grpc#WithCodec
https://github.com/grpc/grpc-go/blob/master/benchmark/worker/benchmark_client.go#L143

And then call send with a []byte:
https://github.com/grpc/grpc-go/blob/master/benchmark/benchmark.go#L225

Let me know if any of that is not clear.
 
Thanks,
Doug


On Tuesday, October 17, 2017 at 4:18:26 PM UTC-7, Kun Zhang wrote:
>
> It sounds like the real question is that how to send already serialized 
> message in Go.
>
> On Thursday, October 12, 2017 at 3:30:08 PM UTC-7, Steven Jiang wrote:
>>
>> The message has to be constructed in C code.  My current implementation 
>> is :
>>   1. construct grpc message in C and pass it as bytes to GO code through 
>> channel;
>>   2. in Go code, call proto.unmarshal to get grpc message;
>>   3.  Send the grpc message out via stream.Send(grpcmsg)
>>
>> What we want is to skip this unmarshal because we've already constructed 
>> the grpc message in C.  Is there any way to do a type cast thing to skip 
>> unmarshal?
>>
>>
>> Thanks
>> Steven
>>
>

-- 
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/3e046048-abc3-4a5b-92bb-d83e01b12175%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to