GRPC.Server.Stream (gRPC Server v1.0.0)

Copy Markdown View Source

A struct as an argument that servers get in rpc function definitions and use to handle headers, send streaming replies.

Notice that you MUST use new stream returned by GRPC.Server as an argument to invoke next functions defined by GRPC.Server.

Fields

  • :server - user defined gRPC server module
  • :adapter - a server adapter module, like GRPC.Server.Adapters.Cowboy
  • request_mod - the request module, or nil for untyped protocols
  • response_mod - the response module, or nil for untyped protocols
  • :codec - the codec
  • :payload - the payload needed by the adapter
  • :local - local data initialized by user
  • :deadline - absolute monotonic-time (ms) by which the inbound request must complete, or nil when the caller set no deadline

Summary

Functions

Milliseconds left before the inbound deadline, or :infinity if the caller set none. Clamped at 0 so an already-expired deadline never returns a negative value.

Types

access_mode()

@type access_mode() :: :grpc | :grpcweb | :http_transcoding

t()

@type t() :: %GRPC.Server.Stream{
  __interface__: map(),
  access_mode: access_mode(),
  adapter: atom(),
  codec: atom(),
  compressor: module() | nil,
  deadline: integer() | nil,
  endpoint: atom(),
  grpc_type: atom(),
  http_method: GRPC.Server.Router.http_method(),
  http_request_headers: map(),
  http_transcode: boolean(),
  is_preflight?: boolean(),
  local: any(),
  method_name: String.t(),
  payload: any(),
  request_id: String.t() | nil,
  request_mod: atom(),
  response_mod: atom(),
  rpc: tuple(),
  server: atom(),
  service_name: String.t()
}

Functions

remaining_ms(stream)

@spec remaining_ms(t()) :: non_neg_integer() | :infinity

Milliseconds left before the inbound deadline, or :infinity if the caller set none. Clamped at 0 so an already-expired deadline never returns a negative value.

send_reply(stream, reply, opts)