tiagopog / grpc-elixir

The Elixir implementation of gRPC

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gRPC Elixir

Build Status Inline docs

The Elixir implementation of gRPC.

WARNING: APIs are unstable now. Be careful to use it in production!

Installation

The package can be installed as:

  1. Add grpc to your list of dependencies in mix.exs:
```elixir
def deps do
  [{:grpc, github: "tony612/grpc-elixir"}]
end
```
  1. Ensure grpc is started before your application:
```elixir
def application do
  [applications: [:grpc]]
end
```

Usage

Generate Elixir code from proto file

$ mix do deps.get, compile
$ mix grpc.gen priv/protos/YOUR_SERVICE.proto --out lib/
$ mix grpc.gen.server priv/protos/YOUR_SERVICE.proto --out lib/

Implement functions in the generated server template, then run the server and client like this:

iex> GRPC.Server.start(Helloworld.Greeter.Server, 50051)
iex> {:ok, channel} = GRPC.Stub.connect("localhost:50051")
iex> request = Helloworld.HelloRequest.new(name: "grpc-elixir")
iex> channel |> Greeter.Stub.say_hello(request)

Check examples for all examples

TODO

  • Unary RPC
  • Server streaming RPC
  • Client streaming RPC
  • Bidirectional streaming RPC
  • Helloworld and RouteGuide examples
  • Doc and more tests
  • Authentication
  • Improve timeout(now there's simple timeout)
  • Errors handling
  • Data compression
  • Benchmarking

Contributing

You contributions are welcome!

Please open issues if you have questions, problems and ideas. You can create pull requests directly if you want to fix little bugs, add small features and so on. But you'd better use issues first if you want to add a big feature or change a lot of code.

About

The Elixir implementation of gRPC

License:Apache License 2.0


Languages

Language:Elixir 98.8%Language:Protocol Buffer 1.2%