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.