Template/example repository for gRPC in combination with C++ and Go. This is mostly experimental - feel free to improve it if you see anything :)
- Bazel 5.4.0
- Go 1.19.4
- Gcc 11.3.0
Besides the above-mentioned prerequisites, also install the following dependencies:
sudo apt install build-essential autoconf libtool pkg-config
Install the protoc
compiler. You can do this in two ways:
- Download protoc 21.6, build it then add the built binary (
bin
file) to yourPATH
environment - Install with
sudo apt-get install protobuf-compiler
I recommend to install it via the first step as the apt-get
repositories tend to lag behind, but it's up to you. Also, don't forget to generate new proto Go files if you have a different version than 21.6.
Navigate to the server
folder and execute the following command:
go install google.golang.org/protobuf/cmd/protoc-gen-go
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc
Make sure that the generated proto files are located in server/proto
, if not, position your terminal into messages
and execute the following command:
protoc --go_out=../server/proto --go_opt=paths=source_relative --go-grpc_out=../server/proto --go-grpc_opt=paths=source_relative *.proto
Position your terminal at the root of the server
folder and execute:
go run .
Position your terminal at the root of the client
folder and execute:
bazel run //:client
Additionally, if you want to test your server without using the client, you can use BloomRPC.