Skip to content
forked from emqx/grpc-erl

An implementation of a gRPC server and client in Erlang.

License

Notifications You must be signed in to change notification settings

Laymer/grpc-erl

 
 

Repository files navigation

gRPC

An implementation of a gRPC server and client in Erlang. HTTP/2 based RPC.

NOTE: The prototypes for this repository are from Bluehouse-Technology/grpc and tsloughter/grpcbox Many thanks to these two repositories for helping me with the implementation :)

TODOs

  • Unary RPC
  • Input streaming/ Output streaming/ Bidirectional streaming
  • Custom metadata
  • Https
  • Encoding: identity, gzip, deflate, snappy
  • Timeout, Error Handling
  • Benchmark

Installation

The application is built from rebar3, so you can introduce it in your rebar.config.

In addition, you need to introduce grpc_plugin plugin to generate client-side and server-side code from the .proto file.

So a regular rebar.config would look something like the following:

{plugins,
 [{grpc_plugin, {git, "https://github.com/HJianBo/grpc_plugin", {tag, "v0.10.1"}}}
]}.

{deps,
 [{grpc, {git, "https://github.com/emqx/grpc", {branch, "master"}}}
 ]}.

%% Configurations for grpc_plugin
{grpc,
 [ {type, all}
 , {protos, ["priv/"]}
 , {out_dir, "src/"}
 , {gpb_opts, []}  %% The gpb compile options, see: https://github.com/tomas-abrahamsson/gpb/blob/master/src/gpb_compile.erl#L120
 ]}.

%% Integrate grpc_plugin generation/clean into rebar3's complie/clean
{provider_hooks,
 [{pre, [{compile, {grpc, gen}},
         {clean, {grpc, clean}}]}
 ]}.

For more detailed examples, you can see the examples/route_guide project.

Dependencies

  • cowboy is used for the server.
  • gun is used for the client.
  • gpb is used to encode and decode the protobuf messages. This is a 'build' dependency: gpb is required to create some modules from the .proto files, but the modules are self contained and don't have a runtime depedency on gpb.

License

Apache 2.0

About

An implementation of a gRPC server and client in Erlang.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Erlang 99.6%
  • Makefile 0.4%