class GRPC::ServerContext

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.cr

Constructors

Instance Method Summary

Constructor Detail

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

[View source]

Instance Method Detail

def cancel : Nil #

cancel marks this call as cancelled from the server side.


[View source]
def cancelled? : Bool #

[View source]
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.


[View source]
def deadline : Time | Nil #

[View source]
def deadline=(deadline : Time | Nil) #

[View source]
def metadata : Metadata #

[View source]
def peer : String #

[View source]
def timed_out? : Bool #

[View source]
def trailing_metadata : Metadata #

[View source]