README.md
1# Generic API Example
2
3## Overview
4
5While generated stub code is often the simpler and best choice for sending and handling API calls,
6generic APIs offer unique advantages in specific scenarios, such as proxy implementation.
7Their ability to manage multiple message types with a single function makes them particularly handy
8in these cases. This example demonstrates how to use generic APIs to achieve this flexibility.
9
10This example implements `greeter_callback_client` and `greeter_callback_server` using the generic APIs.
11Therefore, looking at the difference would be helpful to understand how to use generic APIs.
12
13### Try it!
14
15Once you have working gRPC, you can build this example using either bazel or cmake.
16
17Run the server, which will listen on port 50051:
18
19```sh
20$ ./greeter_server
21```
22
23Run the client (in a different terminal):
24
25```sh
26$ ./greeter_client
27```
28
29If things go smoothly, you will see the client output:
30
31```
32### Send: SayHello(name=World)
33Ok. ReplyMessage=Hello World
34### Send: SayHello(name=gRPC)
35Ok. ReplyMessage=Hello gRPC
36```
37