Similarly, you may also want to look at grpc-web: https://github.com/grpc/grpc-web.
Thanks, Doug On Monday, February 11, 2019 at 8:37:40 PM UTC-8, Danesh Kuruppu wrote: > > Hi Glen, > > Did you try grpc-gateway(https://github.com/grpc-ecosystem/grpc-gateway)? > This is not exactly what you need, but this generates reverse proxy server > which translates JSON to protobuf payload. So it serves in different port > but using same backend gRPC service. > > Thanks > Danesh > > On Monday, February 11, 2019 at 5:37:51 PM UTC+5:30, Glen Huang wrote: >> >> I have a grpc server, and I'm wondering if it's possible to make >> it accept JSON and protobuf payload simultaneously? I want to use the >> server for both backend and frontend communications. >> >> By that I mean, if I have a proto definition like this: >> >> service Greeter { >> rpc SayHello (HelloRequest) returns (HelloReply) {} >> } >> >> message HelloRequest { >> string name = 1; >> } >> >> message HelloReply { >> string message = 1; >> } >> >> and set up a grpc server to listen at port 1234 for example. Obviously I >> can use grpc client to talk to it via port 1234. But Is it possible that I >> can send an http request with a particular JSON payload and path to the >> same port, that can call the SayHello on the server? >> >> I heard it's pretty expansive to encode and decode protobuf with >> javascript, so I hope I could keep using JSON and make grpc accept it >> automatically. >> >> Is that something already feasible? >> >> I use Golang btw. >> >> Thanks in advance. >> > -- 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/4e3f29ab-3869-4c2f-bc7d-31fc57acd676%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
