GRPC::Server
Server hosts registered gRPC services and dispatches incoming RPCs.
Plain TCP example: server = GRPC::Server.new server.handle GreeterImpl.new server.listen "0.0.0.0", 50051
TLS example: server = GRPC::Server.new server.use_tls(cert: "server.crt", key: "server.key") server.handle GreeterImpl.new server.listen "0.0.0.0", 50051
Constants
Constructors
Instance methods
bind sets up the TCP listener without starting the serve loop. Call serve (or start for non-blocking) afterward.
enable_health_checking registers the built-in health service and returns its reporter. Calling this multiple times returns the same instance.
enable_reflection registers the built-in reflection service and returns it. Register FileDescriptorProto bytes on the returned service via add_file_descriptor.
intercept registers a server-side interceptor. Interceptors run outermost-first (first registered wraps all others). Must be called before listen/bind.
listen binds to the given host and port and starts serving. Blocks until stopped.
start runs the server in a background fiber, returning immediately. Useful for tests and embedded servers.
use_tls configures the server to accept TLS connections. cert is the path to the PEM-encoded certificate chain file. key is the path to the PEM-encoded private key file. Must be called before listen/bind.
use_tls with a pre-built OpenSSL context for full control over TLS settings.