grpc-dart/example/route_guide
Jakob Andersen 108181c2d2
Added support for metadata providers. (#39)
Provide a hook for metadata providers that need to generate their
metadata for each RPC. An example is authorization, where the provider
may need to refresh a token before it can provide the header.

Add stackdriver logging examplei to demonstrate calling a Google API.

Updated other examples to protobuf 0.6.0 (protoc plugin 0.7.8).

Updated SDK requirement to Dart 1.24.3, which adds support for creating a SecurityContext that trusts built-in roots, and support for ALPN on macOS.
2017-12-14 14:32:06 +01:00
..
bin Rename examples to example. (#19) 2017-07-04 19:50:18 +02:00
data Rename examples to example. (#19) 2017-07-04 19:50:18 +02:00
lib/src Added support for metadata providers. (#39) 2017-12-14 14:32:06 +01:00
protos Rename examples to example. (#19) 2017-07-04 19:50:18 +02:00
README.md Added support for metadata providers. (#39) 2017-12-14 14:32:06 +01:00
pubspec.yaml Added support for metadata providers. (#39) 2017-12-14 14:32:06 +01:00

README.md

Description

The route guide server and client demonstrate how to use Dart gRPC libraries to perform unary, client streaming, server streaming and full duplex RPCs.

See the definition of the route guide service in protos/route_guide.proto.

Run the sample code

To compile and run the example, assuming you are in the root of the route_guide folder, i.e., .../example/route_guide/, first get the dependencies by running:

$ pub get

Then, to run the server:

$ dart bin/server.dart

Likewise, to run the client:

$ dart bin/client.dart

Regenerate the stubs

If you have made changes to the message or service definition in protos/route_guide.proto and need to regenerate the corresponding Dart files, you will need to have protoc version 3.0.0 or higher and the Dart protoc plugin version 0.7.8 or higher on your PATH.

To install protoc, see the instructions on the Protocol Buffers website.

The easiest way to get the Dart protoc plugin is by running

$ pub global activate protoc_plugin

and follow the directions to add ~/.pub-cache/bin to your PATH, if you haven't already done so.

You can now regenerate the Dart files by running

$ protoc --dart_out=grpc:lib/src/generated -Iprotos protos/route_guide.proto