Hacker News new | ask | show | jobs
by abdusco 724 days ago
> make requests even if you don't have the .proto around

Like this?

    > grpcurl -d '{"id": 1234, "tags": ["foo","bar"]}' \
        grpc.server.com:443 my.custom.server.Service/Method
How is that even possible? How could grpcurl know how to translate your request to binary?
2 comments

If I recall correctly, ProtoBuf has a reflection layer, and it's probably using that.
I could be wrong, but it is probably using json encoding for the object body, and implementing the transport for grpc instead of http. Proto objects support json encode/decode by default in all the implementations I've seen.

https://grpc.io/blog/grpc-with-json/