Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rchanger/go-grpc
Small demonstration of working with grpc in golang
https://github.com/rchanger/go-grpc
go-grpc golang grpc proto
Last synced: about 1 month ago
JSON representation
Small demonstration of working with grpc in golang
- Host: GitHub
- URL: https://github.com/rchanger/go-grpc
- Owner: Rchanger
- Created: 2020-04-14T14:35:31.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-05-05T06:58:54.000Z (over 4 years ago)
- Last Synced: 2023-03-05T17:17:10.350Z (almost 2 years ago)
- Topics: go-grpc, golang, grpc, proto
- Language: Go
- Size: 28.3 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# Go-gRPC
This is simple demonstration of how grpc is to be used with golang.## Setting up the environment required for grpc.
1. Download and install protoc form below link:
~~~
https://github.com/protocolbuffers/protobuf/releases
~~~
2. Next, install Go support for Google’s protocol buffers and grpc:
~~~
go get -u github.com/golang/protobuf/protoc-gen-go
go install github.com/golang/protobuf/protoc-gen-go
go get google.golang.org/grpc
~~~## Running Demo examples.
1. Unary gRPC is explained with example of addition and subtraction example.You will find the example inside __SimpleGRPC__ directory.
For simple/unary grpc sample.pb.go file is generated by executing following command:
~~~
protoc -I SimpleGRPC/ProtoDir/ ./SimpleGRPC/ProtoDir/sample.proto --go_out=plugins=grpc:SimpleGRPC/ProtoDir/
~~~2. Server Side Streaming type of grpc is explained with the help of small example of finding Divisors of number.It is present under __ServerSideStreaming__ directory.
For server side streaming grpc serverStreamingProto.pb.go file is generated by executing following command:
~~~
protoc -I ServerSideStreaming/ServerSideStreamingProto/ ./ServerSideStreaming/ServerSideStreamingProto/serverStreamingProto.proto --go_out=plugins=grpc:ServerSideStreaming/ServerSideStreamingProto/
~~~3. Client Side Streaming type of grpc is explained with the help of small example of finding max number from stream of number.The example is present under __ClientSideStramingGRPC__ directory.
For client side streaming grpc clientstraming.pb.go file is generated by executing following command:
~~~
protoc -I ClientSideStramingGRPC/ClientSideStramingProto/ ./ClientSideStramingGRPC/ClientSideStramingProto/clientstraming.proto --go_out=plugins=grpc:ClientSideStramingGRPC/ClientSideStramingProto/
~~~4. Bidirectional Streaming type of grpc is explained with the help of small example of finding max number from stream of number.The example is present under __BiDirectionGRPC__ directory.
For bidirectional streaming grpc bidirctionalProto.pb.go file is generated by executing following command:
~~~
protoc -I BiDirectionGRPC/BiDirProto/ ./BiDirectionGRPC/BiDirProto/bidirctionalProto.proto --go_out=plugins=grpc:BiDirectionGRPC/BiDirProto/
~~~
#### Small Presentation on grpc: https://drive.google.com/open?id=1_-zI9DtOOa-LYHC79Bdi8YYlIDMt46KISFh35wvaZxI