class
GRPC::ServerContext
- GRPC::ServerContext
- Reference
- Object
Overview
ServerContext holds per-call state accessible to server-side RPC handlers.
Example: def say_hello(req : HelloRequest, ctx : GRPC::ServerContext) : HelloReply puts ctx.peer puts ctx.metadata["authorization"]? HelloReply.new(message: "Hello!") end
Defined in:
grpc/call_context.crConstructors
Instance Method Summary
-
#cancel : Nil
cancel marks this call as cancelled from the server side.
- #cancelled? : Bool
-
#check_active! : Nil
check_active! raises a StatusError when the call is no longer active.
- #deadline : Time | Nil
- #deadline=(deadline : Time | Nil)
- #metadata : Metadata
- #peer : String
- #timed_out? : Bool
- #trailing_metadata : Metadata
Constructor Detail
Instance Method Detail
def check_active! : Nil
#
check_active! raises a StatusError when the call is no longer active. This lets transport and handlers stop work promptly on cancellation/timeout.