Re:gRPC-Go Engineering Practices
by virmundi on Thursday January 25, 2018 @09:39PM
(#16236635)
Has anyone found a good resource on using gRPC directly in a JS client? I've looked at using gRPC. My current challenge is that I want to support a website/webgateway on one side and mobile gateway on the other. If I use Swift or Java on the mobile side, it's easy. If I use Ionic Framework, I'm in the same spot as with the web gateway; probably better off with HTTP + RPC.
[ Parent
| on HN ]
Re:gRPC-Go Engineering Practices
by quietbritishjim on Friday January 26, 2018 @04:36AM
(#16237961)
It is possible to use gRPC directly from JavaScript using the gRPC-Web [1] project by Improbable. More accurately, it uses TypeScript, which is generated from the proto file in a similar way to other languages. You still need a proxy to transform requests from HTTP/1.1 to HTTP/2.0.
I've actually only used the gRPC JSON gateway mentioned in the other replies so I'm not sure how it compares, but it looks interesting.
I wrote https://github.com/zang-cloud/grpc-json to solve this problem. It serves Golang GRPC methods as a JSON API, no configuration required.
Does this work? https://github.com/grpc-ecosystem/grpc-gateway
Seems to generate a REST proxy server side.
I haven't tried it, but that goes against the grain of gRPC. I understand it as an integration point between legacy REST and gRPC. I don't know, and from what I've read, wouldn't use it for greenfield development.
The only issue I have with full HTTPS + JSON is CRIME. I'm not sure how that works.
Re:gRPC-Go Engineering Practices
by Inflatablewoman on Friday January 26, 2018 @01:14AM
(#16237358)
It does work, very well. We have been using it for over a year without issue. It is not ideal, but it is good to have an option for when clients dont support gRPC.