This example is originally found in this repo.
Since this example is being run in the BoxBox environment,
client (prvi/client.exs
) is connecting to boxbox:50051
.
In general, it can be replaced, e.g with localhost:50051
.
- Install deps and compile
$ mix do deps.get, compile
- Run the server
$ mix grpc.server
- Run the client script
$ mix run priv/client.exs
- Modify the proto
priv/protos/helloworld.proto
- Install
protoc
here - Install
protoc-gen-elixir
mix escript.install hex protobuf
- Generate the code:
$ protoc -I priv/protos --elixir_out=plugins=grpc:./lib/ priv/protos/helloworld.proto
Refer to protobuf-elixir for more information.
Change the config to:
config :grpc, start_server: true