examples/

directory
v0.0.0-...-e1a9a74 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 14, 2019 License: MIT

README

gRPC in 3 minutes (Go)

BACKGROUND

For this sample, we've already generated the server and client stubs from helloworld.proto.

PREREQUISITES

$ go help gopath
$ # ensure the PATH contains $GOPATH/bin
$ export PATH=$PATH:$GOPATH/bin

INSTALL

$ go get -u google.golang.org/grpc/examples/helloworld/greeter_client
$ go get -u google.golang.org/grpc/examples/helloworld/greeter_server

TRY IT!

  • Run the server

    $ greeter_server &
    
  • Run the client

    $ greeter_client
    

OPTIONAL - Rebuilding the generated code

  1. Install protobuf compiler

  2. Install the protoc Go plugin

    $ go get -u github.com/golang/protobuf/protoc-gen-go
    
  3. Rebuild the generated Go code

    $ go generate google.golang.org/grpc/examples/helloworld/...
    

    Or run protoc command (with the grpc plugin)

    $ protoc -I helloworld/ helloworld/helloworld.proto --go_out=plugins=grpc:helloworld
    

Directories

Path Synopsis
features
authentication/client
The client demonstrates how to supply an OAuth2 token for every RPC.
The client demonstrates how to supply an OAuth2 token for every RPC.
authentication/server
The server demonstrates how to consume and validate OAuth2 tokens provided by clients for each RPC.
The server demonstrates how to consume and validate OAuth2 tokens provided by clients for each RPC.
cancellation/client
Binary client is an example client.
Binary client is an example client.
cancellation/server
Binary server is an example server.
Binary server is an example server.
compression/client
Binary client is an example client.
Binary client is an example client.
compression/server
Binary server is an example server.
Binary server is an example server.
deadline/client
Binary client is an example client.
Binary client is an example client.
deadline/server
Binary server is an example server.
Binary server is an example server.
debugging/client
Binary client is an example client.
Binary client is an example client.
debugging/server
Binary server is an example server.
Binary server is an example server.
encryption/ALTS/client
Binary client is an example client.
Binary client is an example client.
encryption/ALTS/server
Binary server is an example server.
Binary server is an example server.
encryption/TLS/client
Binary client is an example client.
Binary client is an example client.
encryption/TLS/server
Binary server is an example server.
Binary server is an example server.
errors/client
Binary client is an example client.
Binary client is an example client.
errors/server
Binary server is an example server.
Binary server is an example server.
interceptor/client
Binary client is an example client.
Binary client is an example client.
interceptor/server
Binary server is an example server.
Binary server is an example server.
keepalive/client
Binary client is an example client.
Binary client is an example client.
keepalive/server
Binary server is an example server.
Binary server is an example server.
load_balancing/client
Binary client is an example client.
Binary client is an example client.
load_balancing/server
Binary server is an example server.
Binary server is an example server.
metadata/client
Binary client is an example client.
Binary client is an example client.
metadata/server
Binary server is an example server.
Binary server is an example server.
multiplex/client
Binary client is an example client.
Binary client is an example client.
multiplex/server
Binary server is an example server.
Binary server is an example server.
name_resolving/client
Binary client is an example client.
Binary client is an example client.
name_resolving/server
Binary server is an example server.
Binary server is an example server.
proto
Package proto is for go generate.
Package proto is for go generate.
reflection/server
Binary server is an example server.
Binary server is an example server.
wait_for_ready
Binary wait_for_ready is an example for "wait for ready".
Binary wait_for_ready is an example for "wait for ready".
greeter_client
Package main implements a client for Greeter service.
Package main implements a client for Greeter service.
greeter_server
Package main implements a server for Greeter service.
Package main implements a server for Greeter service.
route_guide
client
Package main implements a simple gRPC client that demonstrates how to use gRPC-Go libraries to perform unary, client streaming, server streaming and full duplex RPCs.
Package main implements a simple gRPC client that demonstrates how to use gRPC-Go libraries to perform unary, client streaming, server streaming and full duplex RPCs.
mocks
Package mock_rgproto is a generated GoMock package.
Package mock_rgproto is a generated GoMock package.
server
Package main implements a simple gRPC server that demonstrates how to use gRPC-Go libraries to perform unary, client streaming, server streaming and full duplex RPCs.
Package main implements a simple gRPC server that demonstrates how to use gRPC-Go libraries to perform unary, client streaming, server streaming and full duplex RPCs.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL