Thanks for the detailed reply, Doug. There is still one issue in my case: If it's a dialout connection, I can change the dialOption. But in my case, the connection is not created by me but by grpc client. I just send back the response. Is there any way to change the codec of the connection initiated by grpc client?
Regards Steven On Tuesday, October 17, 2017 at 4:44:03 PM UTC-7, Doug Fawley wrote: > > 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/549fb1a6-c876-4871-a5fa-32a987563103%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
