George Barnett 054d31085b Add an interceptors tutorial (#1061) il y a 5 ans
..
Implementation 054d31085b Add an interceptors tutorial (#1061) il y a 5 ans
Model 757319c88a Generate client service name and proto service comments (#1059) il y a 5 ans
Runtime 054d31085b Add an interceptors tutorial (#1061) il y a 5 ans
README.md 054d31085b Add an interceptors tutorial (#1061) il y a 5 ans

README.md

Echo, a gRPC Sample App

This directory contains a simple echo server that demonstrates all four gRPC API styles (Unary, Server Streaming, Client Streaming, and Bidirectional Streaming) using the gRPC Swift.

There are three subdirectories:

  • Model containing the service and model definitions and generated code,
  • Implementation containing the server implementation of the generated model,
  • Runtime containing a CLI for the server and client.

Running

Server

To start the server on a free port run:

swift run Echo server 0

To start the server with TLS enabled on port 1234:

swift run Echo server --tls 1234

Client

To invoke the 'get' (unary) RPC with the message "Hello, World!" against a server listening on port 5678 run:

swift run Echo 5678 get "Hello, World!"

To invoke the 'update' (bidirectional streaming) RPC against a server with TLS enabled listening on port 1234 run:

swift run Echo --tls 1234 update "Hello from the client!"

The client may also be run with an --intercept flag, this will print additional information about each RPC and is covered in more detail in the interceptors tutorial (in the docs directory of this project):

swift run Echo --tls --intercept 1234 get "Hello from the interceptors!"