Yabetsu2018
Yabetsu2018

Reputation: 133

How to connect to deployed grpc-server by ip address and host

I want to connect to deployed grpc server by given ipaddress and host like 192.168.0.1:50032 i tried many stuff but as i checked grpc recommendation to have grpc client but i want to try how to post via postman or any by grpc interfaces server. Any suggestion?

Upvotes: 3

Views: 7567

Answers (4)

Yabetsu2018
Yabetsu2018

Reputation: 133

@Eli Bendersky : Setting up the client side answer my question also this code I used

conn, err := grpc.Dial("192.168.0.1:50032", grpc.WithInsecure)

Thank you for your help.

Upvotes: 0

ArkadyB
ArkadyB

Reputation: 1275

You cant use http client to send requests against http2 server, but you can do it with any of available h2 client tools.. For example https://github.com/grpc/grpc/blob/master/doc/command_line_tool.md.

Upvotes: 0

Vitaly Isaev
Vitaly Isaev

Reputation: 5815

Basically you're not able to post GRPC request via Postman, because GRPC messages are binary (protobuf-serialized), while Postman is designed to work only with plain HTTP requests. You'll have to deploy some kind of proxy in front of your service in order to use Postman.

From my point of view, it's much easier just to write your client that fits your needs. The greatest part of job is already done by protoc-gen-grpc, because it generates client API, and you need just to build request and send it.

Upvotes: 1

Eli Bendersky
Eli Bendersky

Reputation: 273806

conn, err := grpc.Dial("192.168.0.1:50032")
if err != nil {
    ...
}

Here's a basic tutorial you should follow

Upvotes: 3

Related Questions