Orbit Framework 2.0.0
A high-performance asynchronous C++20 HTTP server framework.
Loading...
Searching...
No Matches
GrpcServer.hpp
Go to the documentation of this file.
1#pragma once
3#include <memory>
4#include <string>
5#include <vector>
6
7namespace grpc {
8 class Server;
9 class Service;
10}
11
12namespace orbit::server {
13
27public:
30
32 void add_service(grpc::Service* service);
33
36 void start(const std::string& address);
37
39 int port() const { return port_; }
40
41 void stop();
42
43private:
44#ifdef ORBIT_ENABLE_GRPC
45 std::unique_ptr<grpc::Server> server_;
46 std::vector<grpc::Service*> services_;
47#endif
48 int port_ = 0;
49};
50
51} // namespace server
A thin wrapper that runs gRPC services next to an Orbit App.
Definition GrpcServer.hpp:26
void start(const std::string &address)
void add_service(grpc::Service *service)
Registers a service; it must outlive the server. Call before start().
int port() const
The port listened on once started, e.g. the one chosen for port 0.
Definition GrpcServer.hpp:39
int port_
Definition GrpcServer.hpp:48
Definition GrpcServer.hpp:7
Definition Http2Session.hpp:18