class

GRPC::ServerContext

Inherits Reference < Object

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

Constructors

new(peer : String, metadata : Metadata = Metadata.new, deadline : Time | Nil = nil)
Source

Instance methods

cancel

cancel marks this call as cancelled from the server side.

Source
cancelled?
Source
check_active!

check_active! raises a StatusError when the call is no longer active. This lets transport and handlers stop work promptly on cancellation/timeout.

Source
deadline
Source
deadline=(deadline : Time | Nil)
Source
initial_metadata
Source
metadata
Source
peer
Source
send_initial_metadata(metadata : Metadata) : Nil

Adds metadata to the initial HTTP/2 response headers. This must be called before the first response message is written.

Source
timed_out?
Source
trailing_metadata
Source