{"id":13741206,"url":"https://github.com/bluehouse-technology/grpc","last_synced_at":"2025-05-02T10:31:51.022Z","repository":{"id":44366574,"uuid":"94447848","full_name":"Bluehouse-Technology/grpc","owner":"Bluehouse-Technology","description":"Erlang library for GRPC","archived":false,"fork":false,"pushed_at":"2023-07-29T21:06:13.000Z","size":191,"stargazers_count":100,"open_issues_count":7,"forks_count":39,"subscribers_count":12,"default_branch":"master","last_synced_at":"2024-08-04T04:07:35.670Z","etag":null,"topics":["erlang","grpc-client","grpc-server"],"latest_commit_sha":null,"homepage":null,"language":"Erlang","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Bluehouse-Technology.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-06-15T14:32:06.000Z","updated_at":"2024-05-11T01:17:37.000Z","dependencies_parsed_at":"2024-01-25T06:49:08.875Z","dependency_job_id":null,"html_url":"https://github.com/Bluehouse-Technology/grpc","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bluehouse-Technology%2Fgrpc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bluehouse-Technology%2Fgrpc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bluehouse-Technology%2Fgrpc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bluehouse-Technology%2Fgrpc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Bluehouse-Technology","download_url":"https://codeload.github.com/Bluehouse-Technology/grpc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224307523,"owners_count":17289834,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["erlang","grpc-client","grpc-server"],"created_at":"2024-08-03T04:00:56.737Z","updated_at":"2024-11-12T16:26:23.188Z","avatar_url":"https://github.com/Bluehouse-Technology.png","language":"Erlang","funding_links":[],"categories":["Language-Specific"],"sub_categories":["Erlang"],"readme":"# gRPC\r\n\r\nAn implementation of a gRPC server in Erlang. \r\n\r\nAn implementation of the client side is also available: [grpc_client](https://github.com/Bluehouse-Technology/grpc_client).\r\n\r\n## A quick \"Hello world\" example\r\n\r\nThe file \"helloworld.proto\" contains the specification for a simple \"hello\r\nworld\" service:\r\n\r\n```\r\nsyntax = \"proto3\";\r\n\r\npackage helloworld;\r\n\r\n// The greeting service definition.\r\nservice Greeter {\r\n  // Sends a greeting\r\n  rpc SayHello (HelloRequest) returns (HelloReply) {}\r\n}\r\n\r\n// The request message containing the user's name.\r\nmessage HelloRequest {\r\n  string name = 1;\r\n}\r\n\r\n// The response message containing the greetings\r\nmessage HelloReply {\r\n  string message = 1;\r\n}\r\n```\r\n\r\nCompile this file (from the Erlang shell):\r\n```\r\n1\u003e grpc:compile(\"helloworld.proto\").\r\n```\r\nThis creates two files: `helloworld.erl`  and `helloworld_server.erl`. The\r\nfirst file contains code to encode and decode the gRPC messages (in\r\nprotocol buffer format). The second file contains type specifications for\r\nthe messages and a 'skeleton' for the RPC:\r\n\r\n```erlang\r\n-spec 'SayHello'(Message::'HelloRequest'(), Stream::grpc:stream(), State::any()) -\u003e\r\n    {'HelloReply'(), grpc:stream()} | grpc:error_response().\r\n%% This is a unary RPC\r\n'SayHello'(_Message, Stream, _State) -\u003e\r\n    {#{}, Stream}.\r\n```\r\n\r\nSome code must be added to the skeleton to make it work:\r\n\r\n```erlang\r\n'SayHello'(#{name := Name}, Stream, _State) -\u003e\r\n    {#{message =\u003e \"Hello, \" ++ Name}, Stream}.\r\n```\r\n \r\nNow compile the modules and start the server (it will listen to port 10000):\r\n\r\n```erlang\r\n2\u003e c(helloworld).\r\n3\u003e c(helloworld_server).\r\n4\u003e grpc:start_server(hello, tcp, 10000, helloworld_server, []).\r\n``` \r\n\r\nTo see if it actually works you will need a grpc client. These exist in\r\nmany languages (see [grpc.io](https://grpc.io)), but here we will use the\r\nerlang client\r\n([grpc_client](https://github.com/Bluehouse-Technology/grpc_client)):\r\n\r\n```erlang\r\n1\u003e grpc_client:compile(\"helloworld.proto\").\r\n2\u003e c(helloworld).\r\n3\u003e c(helloword_client).\r\n4\u003e {ok, Connection} = grpc_client:connect(tcp, \"localhost\", 10000).\r\n4\u003e helloworld_client:'SayHello'(Connection, #{name =\u003e \"World\"}, []).\r\n{ok,#{grpc_status =\u003e 0,\r\n      headers =\u003e #{\u003c\u003c\":status\"\u003e\u003e =\u003e \u003c\u003c\"200\"\u003e\u003e},\r\n      http_status =\u003e 200,\r\n      result =\u003e #{message =\u003e \"Hello, World\"},\r\n      status_message =\u003e \u003c\u003c\u003e\u003e,\r\n      trailers =\u003e #{\u003c\u003c\"grpc-status\"\u003e\u003e =\u003e \u003c\u003c\"0\"\u003e\u003e}}}\r\n```\r\n\r\n## Documentation \r\nThere are many more things you can do beyond what is shown in the simple\r\nexample above - streaming from client to server,\r\nfrom server to client, both ways, adding metadata, compression,\r\nauthentication ... - see the\r\n[tutorial](/doc/tutorial.md) for more examples and further details, or the\r\n[reference\r\ndocumentation](https://github.com/Bluehouse-Technology/grpc/wiki/gRPC-reference-documentation)\r\nfor the details of the\r\nindividual modules and functions.\r\n\r\n## Build\r\ngRPC uses [erlang.mk](https://erlang.mk/) as build tool. On Unix systems it can be built\r\nwith: \r\n\r\n```\r\nmake\r\n```\r\n\r\n`make doc` can be used to generate documentation for the individual\r\nmodules from edoc comments in those modules.\r\n\r\nSee the [erlang.mk documentation](https://erlang.mk/guide/installation.html#_on_windows) for\r\nan explanation on how the tool can be used in a Windows environment.\r\n\r\n## Testing\r\n`make ct` can be used to run a number of tests. \r\n\r\nIn the test directory there is an explanation how the software can be\r\ntested against the go gRPC implementation.\r\n\r\n## Dependencies\r\n\r\n- [cowboy](https://github.com/ninenines/cowboy) is used for the server.\r\n\r\n- [gpb](https://github.com/tomas-abrahamsson/gpb) is used to encode and\r\n  decode the protobuf messages. This is a 'build' dependency: gpb is\r\n  required to create some modules from the .proto files, but the modules\r\n  are self contained and don't have a runtime depedency on gpb.\r\n\r\n\r\n## Acknowledgements\r\n\r\nThe development of this application was championed by [Holger Winkelmann](https://github.com/hwinkel) of [Travelping](https://github.com/travelping). [Travelping](https://github.com/travelping) also kindly provided sponsorship for the initial development. The development was primarily done by [Willem de Jong](https://github.com/willemdj) with design input from [Chandru Mullaparthi](https://github.com/cmullaparthi).\r\n\r\n## License\r\n\r\nApache 2.0\r\n\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbluehouse-technology%2Fgrpc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbluehouse-technology%2Fgrpc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbluehouse-technology%2Fgrpc/lists"}