Comments (3)
Why don't you release a standalone grpc to JSON gateway?
So you are asking for something that just translates the protobuf binary payloads to JSON? FWIW, streaming and other gRPC protocol features such as compression would not really work well with this.
It sounds like maybe you are wanting a gRPC-web client that uses JSON, paired with a server that uses JSON. This is currently problematic because https://github.com/grpc/grpc-web uses a JS protobuf library that does not support JSON. So a few things you might instead consider:
- You could use https://github.com/bufbuild/connect-es to create gRPC-web clients that support JSON and then also use an
encoding.Codec
in your server that supports JSON (if you are using a Go server anyway). TheCodec
interface is easy to implement for JSON: the two methods map to functions of the same name in theprotojson
package. - You could use Connect instead of gRPC. It supports JSON out of the box. (Implementations currently available in TS/JS, Go, Kotlin/Android, and Swift/iOS).
from grpcui.
I'm just looking for a way to consume the grpc server on a web frontend.
Idk what buf has to do with any of this. Everywhere I go in the grpc world I'm met with buf marketing.
Forget I asked, it was a stupid idea.
grpc is not fit for the web.
from grpcui.
I'm just looking for a way to consume the grpc server on a web frontend.
@idc77, the "official" answer from the gRPC team is probably to use gRPC-Web: https://github.com/grpc/grpc-web
However, it uses Protobuf binary encoding, not JSON (though it does have an option to use the Protobuf text format). The gRPC-Web protocol is a little different than gRPC so that it can support HTTP 1.1 and browser HTTP client capabilities. So it requires running a proxy in front of your gRPC server that translates from the gRPC-Web proxy. There is also an Envoy filter, so if you already run Envoy as an ingress/reverse proxy or as a sidecar (like in a service mesh), it can be configured to automatically translate gRPC-Web to gRPC.
grpc is not fit for the web.
You might check out Connect: it was designed for web and mobile use cases. So it should be a much better experience. It supports JSON, it has a curl-friendly protocol for unary RPCs, and works in web (TS/JS) and mobile (Kotlin and Swift).
from grpcui.
Related Issues (20)
- Additional headers -H works with grpcurl but not grpcui HOT 3
- Embedding clarification for subroutes. HOT 2
- Can't work with proto definitions that include includes external proto definitions. HOT 2
- insecure flag doing nothing HOT 2
- Output the size of the binary request/response in verbose log
- -open-browser=true doesn't work properly on faulty open handlers
- -default-header would be clear when using -examples at the same time HOT 2
- Failed to dial target host "localhost:8181": context deadline exceeded HOT 3
- Can't I use Dockerfile? HOT 2
- where is the docker image hosted? HOT 5
- Import Error "lookup of '$ret6' failed HOT 3
- The browser displays a connection error. HOT 1
- How can I wait for stream answers? HOT 1
- Is gRPC curl still visible from `Raw request` tab?
- Runtime error: invalid memory address or nil pointer dereference HOT 4
- M1 grpcui -plaintext localhost:8023 Failed to compute set of methods to expose: proto: invalid syntax: "<unknown:0>" HOT 5
- Failed to compute set of methods to expose: EOF
- undefined: indent HOT 1
- Shareable grpcui link that auto-populates request
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grpcui.