Click on snippet source
to jump to the code of an individual example.
// ---------------------------------------------------
// A simple client-streaming request with coroutines.
// ---------------------------------------------------
// ---------------------------------------------------
// A simple server-streaming request with coroutines.
// ---------------------------------------------------
// ---------------------------------------------------
// A bidirectional-streaming request that simply sends the response from the server back to it.
// ---------------------------------------------------
// ---------------------------------------------------
// A unary request with a per-RPC step timeout. Using a unary RPC for demonstration purposes, the same mechanism can be
// applied to streaming RPCs, where it is arguably more useful.
// For unary RPCs, `grpc::ClientContext::set_deadline` should be preferred.
// ---------------------------------------------------
// ---------------------------------------------------
// Multi-threaded client using multiple GrpcContexts
// ---------------------------------------------------
// ---------------------------------------------------
// Multi-threaded client using single a GrpcContext
// ---------------------------------------------------
// ---------------------------------------------------
// A simple generic unary with Boost.Coroutine.
// ---------------------------------------------------
// ---------------------------------------------------
// A generic bidirectional-streaming request that simply sends the response from the server back to it using Asio's
// stackless coroutines.
// ---------------------------------------------------
// ---------------------------------------------------
// Example showing how to run an io_context and a GrpcContext on the same thread for gRPC clients.
// ---------------------------------------------------
// ---------------------------------------------------
// Example showing how to transfer files over a streaming RPC. Stack buffers are used to customize memory allocation.
// ---------------------------------------------------
// ---------------------------------------------------
// Server-side hello world which handles exactly one request from the client before shutting down.
// ---------------------------------------------------
// ---------------------------------------------------
// A simple client-streaming rpc handler using C++20 coroutines.
// ---------------------------------------------------
// ---------------------------------------------------
// A simple server-streaming rpc handler using C++20 coroutines.
// ---------------------------------------------------
// ---------------------------------------------------
// A server-streaming rpc handler that sends a message every 30s but completes immediately if the client cancels the
// rpc.
// ---------------------------------------------------
// ---------------------------------------------------
// The following bidirectional-streaming example shows how to dispatch requests to a thread_pool and write responses
// back to the client.
// ---------------------------------------------------
// ---------------------------------------------------
// Multi-threaded server handling unary requests using callback API and multiple GrpcContexts
// ---------------------------------------------------
// ---------------------------------------------------
// Multi-threaded server handling unary requests using callback API and single GrpcContext
// ---------------------------------------------------
// ---------------------------------------------------
// Handle a simple generic unary request with Boost.Coroutine.
// ---------------------------------------------------
// ---------------------------------------------------
// A bidirectional-streaming example that shows how to dispatch requests to a thread_pool and write responses
// back to the client.
// ---------------------------------------------------
// ---------------------------------------------------
// Example showing how to run an io_context and a GrpcContext on the same thread for gRPC servers.
// This can i.e. be useful when writing an HTTP server that occasionally reaches out to a gRPC server. In that case
// creating a separate thread for the GrpcContext might be undesirable due to added synchronization complexity.
// ---------------------------------------------------
// ---------------------------------------------------
// Example showing how to transfer files over a streaming RPC. Stack buffers are used to customize memory allocation.
// ---------------------------------------------------
// ---------------------------------------------------
// A simple unary request with unifex coroutines.
// ---------------------------------------------------
// ---------------------------------------------------
// A server-streaming request with unifex sender/receiver.
// ---------------------------------------------------
// ---------------------------------------------------
// A unifex, unary request with a per-RPC step timeout. Using a unary RPC for demonstration purposes, the same mechanism
// can be applied to streaming RPCs, where it is arguably more useful. For unary RPCs,
// `grpc::ClientContext::set_deadline` is the preferred way of specifying a timeout.
// ---------------------------------------------------
// ---------------------------------------------------
// Register a request handler to unary requests. A bit of boilerplate code regarding stop_source has been added to make
// the example testable.
// ---------------------------------------------------
// ---------------------------------------------------
// A simple server-streaming request handler using coroutines.
// ---------------------------------------------------