Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to write client codeto gprc connect #80

Open
lee123456780 opened this issue Nov 3, 2020 · 2 comments
Open

how to write client codeto gprc connect #80

lee123456780 opened this issue Nov 3, 2020 · 2 comments

Comments

@lee123456780
Copy link

can you give me a client demo code for gRPC ? ths

@lee123456780
Copy link
Author

MY CODE LIKE THIS
conn, err := grpc.Dial("localhost:1234", grpc.WithInsecure()) if err != nil { log.Fatal(err) } defer conn.Close() ct := go_protoc.NewGreeterClient(conn) re, err1 := ct.SayHello(context.Background(), &go_protoc.HelloRequest{ Name: "hello word", }) fmt.Println(re) if err1 != nil { log.Fatal(err1) }
BUT I GOT AN ERROR :
rpc error: code = Unavailable desc = timed out waiting for server handshake
WHAT'S WRONG?

@stevenferrer
Copy link

As per README, you'll have to match with writers.

grpcl := m.MatchWithWriters(cmux.HTTP2MatchHeaderFieldSendSettings("content-type", "application/grpc"))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants