grpc-web | gRPC for Web Clients
kandi X-RAY | grpc-web Summary
kandi X-RAY | grpc-web Summary
A JavaScript implementation of gRPC for browser clients. For more information, including a quick start, see the gRPC-web documentation. gRPC-web clients connect to gRPC services via a special proxy; by default, gRPC-web uses Envoy. In the future, we expect gRPC-web to be supported in language-specific web frameworks for languages such as Python, Java, and Node. For details, see the roadmap. Java gRPC-web in-process proxy implementation is in beta stage. For details, see details.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Process length bytes .
- Echo the request stream to the server
- Say the call to each repeat
- Processes the frame byte buffer .
- Returns a new server instance of Echo .
- Say Say Hello
- Copy the metadata to the metadata .
- Returns a function to send the message to the callback
- Create symbolic link
- Finishes the message and returns a new message .
grpc-web Key Features
grpc-web Examples and Code Snippets
Community Discussions
Trending Discussions on grpc-web
QUESTION
Client (nuxt
) is up on http://localhost:3000
and the client sends
requests to http://localhost:8080
.
Server (django
) is running on 0.0.0.0:50051
.
Also docker
is up
ANSWER
Answered 2021-Dec-20 at 15:29I needed a proxy to receive requests from the server. So I used envoy proxy. In this way, nginx received the request from the browser and then sent it to a port (for example 5000). On the other hand, envoy
listens to port 5000 and then sends the request to the server running on port 50051.
This is how I designed the tracking of a gRPC
connection.
QUESTION
I'm novice in gRPC. My program is written with nuxtjs
and is a simple login page
that receives the username
and password
and sends it to the server using gRPC.
Everything is fine when I submit a request with BloomRPC. But when using the browser, the request is not sent to the server.
My auth
class is as follow:
ANSWER
Answered 2021-Dec-17 at 14:00According to chrome screenshot you trying to access to 5005
port in JS, but according to BloomRPC, screenshot your service listening 50051
.
QUESTION
I have a web application with the following stack:
- UI: Flutter Web/Dart
- Server: Go
- Communication Protocol: gRPC/gRPC-Web
I have defined a few protobufs and compiled them into both Go and Dart successfully. When I run the Go server code, I am able to successfully make gRPC calls with Kreya, however when I try making the same call from Flutter using grpc/grpc_web.dart
, though I keep running into the following error:
ANSWER
Answered 2021-Dec-21 at 06:52I was able to resolve the issue by taking the suggestion in the comments and using Envoy to proxy instead of the go-proxy, though the solution didn't work purely out of the box according to the linked post.
Here is the working envoy.yaml
QUESTION
I have a web app using gRPC Web to interact with my gRPC service through a dockerized Envoy Proxy. When I try calling the endpoint exposed in Envoy, I receive the following error:
gRPC Error (code: 14, codeName: UNAVAILABLE, message: upstream connect error or disconnect/reset before headers. reset reason: protocol error, details: [], rawResponse: null, trailers: {content-length: 0})
Here is my client side code:
...ANSWER
Answered 2021-Dec-21 at 06:40After a lot of frustration and playing around, I finally figured it out. Looking at the documentation, it seems like the envoy.filters.httl.grpc_web
filter can translate a request to both HTTP/2 and HTTP/3. I am assuming (though if someone more knowledgeable in this field can correct me, please do) that without specifying, Envoy does not know what protocol to translate to. As such, simply adding http2_protocol_options: {}
to my cluster
resolved the issue. I'm including the full cluster
block below for anyone that may come across the same issue in the future.
QUESTION
I have an application running on my local machine that uses React -> gRPC-Web -> Envoy -> Go app and everything runs with no problems. I'm trying to deploy this using GKE Autopilot and I just haven't been able to get the configuration right. I'm new to all of GCP/GKE, so I'm looking for help to figure out where I'm going wrong.
I was following this doc initially, even though I only have one gRPC service: https://cloud.google.com/architecture/exposing-grpc-services-on-gke-using-envoy-proxy
From what I've read, GKE Autopilot mode requires using External HTTP(s) load balancing instead of Network Load Balancing as described in the above solution, so I've been trying to get that to work. After a variety of attempts, my current strategy has an Ingress, BackendConfig, Service, and Deployment. The deployment has three containers: my app, an Envoy sidecar to transform the gRPC-Web requests and responses, and a cloud SQL proxy sidecar. I eventually want to be using TLS, but for now, I left that out so it wouldn't complicate things even more.
When I apply all of the configs, the backend service shows one backend in one zone and the health check fails. The health check is set for port 8080 and path /healthz which is what I think I've specified in the deployment config, but I'm suspicious because when I look at the details for the envoy-sidecar container, it shows the Readiness probe as: http-get HTTP://:0/healthz headers=x-envoy-livenessprobe:healthz. Does ":0" just mean it's using the default address and port for the container, or does indicate a config problem?
I've been reading various docs and just haven't been able to piece it all together. Is there an example somewhere that shows how this can be done? I've been searching and haven't found one.
My current configs are:
...ANSWER
Answered 2021-Oct-14 at 22:35Here is some documentation about Setting up HTTP(S) Load Balancing with Ingress. This tutorial shows how to run a web application behind an external HTTP(S) load balancer by configuring the Ingress resource.
Related to Creating a HTTP Load Balancer on GKE using Ingress, I found two threads where instances created are marked as unhealthy.
In the first one, they mention the necessity to manually enable a firewall rule to allow http load balancer ip range to pass health check.
In the second one, they mention that the Pod’s spec must also include containerPort. Example:
QUESTION
I am using grpc-web to communicate with a java backend over gRPC. I am using ReactJS on the frontend which uses grpc-web to interpret the protobuffers.
I am getting this strange error. My protos are correct ( I checked using a reflection tool called "bloom" so the backend is just fine) This somehow seems like an error internal to the grpc libraries I am using in ReactJS.
I get the following error:
TypeError: Cannot read properties of undefined (reading 'MethodInfo')
The above error points to my proto file: dashboard_services_grpc_web_pb.js
In this file, it point to this line
const methodInfo_DashboardService_userLogin = new grpc.web.AbstractClientBase.MethodInfo( ...... );
I have a hard time solving this because according to my understanding, grpc.web.AbstractClientBase
is something native to grpc-web
.
I have also reinstalled my node_modules in hopes that this is a version issue but no avail.
...ANSWER
Answered 2021-Oct-15 at 09:34I had the same issue because I was using an old release of the executable protoc-gen-grpc-web
with respect to the current version of grpc-web
. Using version 1.3.0 for both solved the issue for me.
You can download the latest release of protoc-gen-grpc-web
here.
QUESTION
I've written a .NET API application that listens on two ports:
- 5000 for regular HTTP requests (HTTP1)
- 5001 for gRPC (HTTP2)
I'm deploying my images via docker-compose
using labels:
ANSWER
Answered 2021-Oct-23 at 23:17labels:
- traefik.http.routers.http-router.rule=Host(`api.example.com`)
- traefik.http.routers.http-router.service=http-service
- traefik.http.services.http-service.loadbalancer.server.port=5000
- traefik.http.routers.grpc-router.rule=Host(`api-grpc.example.com`)
- traefik.http.routers.grpc-router.service=grpc-service
- traefik.http.services.grpc-service.loadbalancer.server.port=5001
- traefik.http.services.grpc-service.loadbalancer.server.scheme=h2c
QUESTION
I am facing this error with envoy proxy :
upstream connect error or disconnect/reset before headers. reset reason: connection failure
| 503 service unavailable.
This is my envoy.yaml
...ANSWER
Answered 2021-Sep-21 at 07:28I mess up with the endpoint address. I replace localhost with the name of my container and I rebuilt my container after that because the file was copied to the container thanks to my dockerfile.
QUESTION
I'm trying to log in to a website using requests module. While creating a script to do so, I could notice that the payload used in there is completely different from the conventional approach. This is exactly how the payload +åEMAIL"PASSWORD(0
looks like. This is the content type parameters content-type: application/grpc-web+proto
.
The following is what I see in dev tools when I log in to that site manually:
...ANSWER
Answered 2021-Aug-18 at 12:50I don't think that you'll be able to use Python Requests
to login to your target site.
Your post_link url
:
QUESTION
I am trying to create a grpc server with the hep of grpc-web wrapper. The idea is to use this grpc server both with browser based application as well as with the normal grpc client. But i am confused how can i make it work for both the applications?
...ANSWER
Answered 2021-Apr-28 at 21:33As per the comments the issue is that you are were attempting to connect to a gRPC-Web server using a gRPC client. gRPC and gRPC-Web are different wire protocols (gRPC-Web was created because web browser APIs don't provide sufficient control over HTTP/2 requests to implement gRPC). This blog post provides a good overview.
Because you are building a web-app you will need to use gRPC-Web; if you also wish to connect to your server using a go client then the preferred option is to use gRPC (the server can both simultaneously). Another option that could work would be to use a gRPC-Web client but I've not tried this (it will be less efficient).
The 'official' way of running gRPC-Web is via an envoy plugin but as you are writing this in Go improbable-eng/grpc-web provides another, simpler, option which you are already utilising (they also have a proxy but that makes deployment more complex).
Your server needs to be altered to run both gRPC and gRPC-Web. The simplest option is to run these on different ports (it may be possible to use a mux to detect the content-type but this is not something I've tried; it does work well if you want to serve html/js and gRPC-Web on a single port).
The approach I'd take to run both servers follows (please treat this as incomplete pseudo code, I have pulled bits from a few of my applications but have not compiled/tested etc; feel free to update when you discover issues!):
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install grpc-web
Define your service using protocol buffers
Implement a simple gRPC Service using NodeJS
Configure the Envoy proxy
Generate protobuf message classes and client service stub for the client
Compile all the JS dependencies into a static library that can be consumed by the browser easily
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page