xref: /aosp_15_r20/external/pigweed/pw_grpc/docs.rst (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1.. _module-pw_grpc:
2
3=======
4pw_grpc
5=======
6.. pigweed-module::
7   :name: pw_grpc
8
9``pw_grpc`` is an implementation of the gRPC over HTTP2 protocol that utilizes
10``pw_rpc`` for code generation and service hosting. It provides classes that map
11between pw_rpc packets and gRPC HTTP2 frames, allowing pw_rpc services to be
12exposed as gRPC services.
13
14--------
15Overview
16--------
17The ``Connection`` class implements the gRPC HTTP2 protocol on top of a socket
18like stream. Create a new instance every time a new connection is established.
19It will notify when new RPC calls are started, data is received, the call is
20cancelled, and when the connection stream should be closed.
21
22The ``PwRpcHandler`` class is what maps gRPC events provided by ``Connection``
23instances to ``pw_rpc`` packets. It takes a ``pw::rpc::RpcPacketProcessor``
24to forward packets to.
25
26The ``GrpcChannelOutput`` class is what handles mapping outgoing ``pw_rpc``
27packets back to the ``Connection`` send methods, which will translate to gRPC
28responses.
29
30Refer to the ``test_pw_rpc_server.cc`` file for detailed usage example of how to
31integrate into a ``pw_rpc`` network.
32