GRPC.Server.Adapters.Cowboy (gRPC v0.11.4)

View Source

A server (b:GRPC.Server.Adapter) adapter using :cowboy.

Cowboy requests will be stored in the :payload field of the GRPC.Server.Stream.

Summary

Functions

child_spec(endpoint, servers, port, opts)

@spec child_spec(
  atom(),
  %{required(String.t()) => [module()]},
  non_neg_integer(),
  Keyword.t()
) ::
  Supervisor.child_spec()

Return a child_spec to start server. See GRPC.Server.Adapters.Cowboy.start/4 for a list of supported options.

get_bindings(map)

get_cert(map)

get_headers(map)

get_peer(map)

get_qs(map)

read_body(map)

@spec read_body(GRPC.Server.Adapter.state()) :: {:ok, binary()}

reading_stream(map)

@spec reading_stream(GRPC.Server.Adapter.state()) :: Enumerable.t()

send_trailers(map, trailers)

set_compressor(map, compressor)

set_headers(map, headers)

set_resp_trailers(map, trailers)

start(endpoint, servers, port, opts)

Starts a Cowboy server. Only used in starting a server manually using GRPC.Server.start(servers). Otherwise GRPC.Server.Adapters.Cowboy.child_spec/4 is used.

The available options below are a subset of ranch_tcp's options.

Options

  • :net - If using :inet (IPv4 only - the default) or :inet6 (IPv6)
  • :ip - The IP to bind the server to. Must be either a tuple in the format {a, b, c, d} with each value in 0..255 for IPv4, or a tuple in the format {a, b, c, d, e, f, g, h} with each value in 0..65535 for IPv6, or a tuple in the format {:local, path} for a unix socket at the given path. If both :net and :ip options are given, make sure they are compatible (i.e. give a IPv4 for :inet and IPv6 for :inet6). The default is to listen on all interfaces.
  • :ipv6_v6only - If true, only bind on IPv6 addresses (default: false).

start_link(scheme, endpoint, servers, arg)

@spec start_link(atom(), atom(), %{required(String.t()) => [module()]}, any()) ::
  {:ok, pid()} | {:error, any()}