I am unable to use grpc-web wrapped server with normal grpc client?
See original GitHub issuehttps://github.com/gustavohenrique/grpc-web-golang-vuejs/tree/master/backend I have this backend server which is successfully communicating with the vue.js client. But i am unable to call the grpc function with the normal grpc client. Is it possible to use grpcweb wrapped server with both browser based app as well as normal backend clients? If yes then how?
Here is the small code which i was trying to connect to itā¦
package main
import (
"context"
"fmt"
"io"
"log"
"time"
pb "backend/proto"
"google.golang.org/grpc"
)
func main() {
fmt.Println("Hello I'm a client")
conn, err := grpc.Dial("0.0.0.0:9000", grpc.WithInsecure())
if err != nil {
log.Fatalf("could not connect: %v", err)
}
defer conn.Close()
c := pb.NewAccountServiceClient(conn)
doUnary(c)
}
func doUnary(c pb.AccountServiceClient) {
fmt.Println("do unary from the client")
req := &pb.User{
Email: "hh1212",
Password: "23123",
}
res, err := c.Create(context.Background(), req)
if err != nil {
log.Fatalf("error while calling Greet RPC: %v", err)
}
//log.Printf("Response from Greet: %v", res.GetEmail())
}
Issue Analytics
- State:
- Created 2 years ago
- Comments:5
Top Results From Across the Web
Does grpcweb.WrapServer respect client deadlines? #1029
Hi, I'm using code like this go func() { defer func() { if r := recover(); r != nil { log. ... On...
Read more >grpcweb wrapped server functions call via golang client?
This project is using grpcweb wrapped server. Then i wrote a small client to call the grpc server functions But it is not...
Read more >gRPC: Go Server & Web Client
Because if the gRPC Web client wants to communicate with gRPC server, we need to modify the server to wrap the gRPC server...
Read more >An all-in-one guide to gRPC-Gateway
gRPC -Gateway is a plugin that can be used to generate a reverse proxy server for gRPC services that convert Restful/JSON into gRPC....
Read more >The state of gRPC in the browser
The basic idea is to have the browser send normal HTTP requests (with ... The Google gRPC-Web client is implemented in JavaScript using...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
š¤·š» you can check out my example repositories and see if they work for you. Iām guessing thereās something going on with your local set up, not much I can help with there.
No, thatās not enough. I explained that you need to split the traffic. Your handler is just replying with nothing when the request isnāt a grpc-web request. You need to add `grpcServer.ServeHTTP inside your handler: