Skip to main content

Quick Start

Overview

This paper will describe how to quickly use gRPC customers to connect to rpc.

Sample

Preparation

We do the following execution to generate a proto file and pb file.

# Create demo service directory
$ mkdir demo && cd demo
# go mod initializing
$ go mod init demo
# Generate greet. roto file
$ goctl rpc -o greet.proto
# pun pb.go file
$ protoc greet.proto --go_out=. --go-grpc_out=.
# Create client directory
$ mkdir client && cd client
# Add profile
$ mkdir etc && cd etc
$ touch gret-client. aml
# Add client.go file
$ touch client.go

Reference configuration and content

Target: 127.0.0.1:8080
small trick

If you also find it troublesome to write the code, please try goctl scroll code generated, refer to goctl rpc

More gRPC connections (service register, service discovery, cluster direct, intermediate use etc.) can be consulted rpc service connection

References