In-process SkirRPC dispatcher.
handle_request/3 accepts the raw SkirRPC payload used by both POST bodies and
decoded GET query strings, and returns a transport-neutral RawResponse.
Summary
Functions
Registers a method and an arity-2 handler receiving the decoded request and metadata. Duplicate method numbers raise ArgumentError.
Dispatches a raw SkirRPC payload, list, or studio and returns a Skir.RPC.RawResponse. Metadata is passed to the handler.
Creates a service. Options configure unknown fields, error disclosure/logging, Studio, and request size.
Controls whether internal error messages reach clients, using a boolean or an ErrorInfo predicate. Default: hidden.
Sets the callback receiving Skir.RPC.ErrorInfo for controlled and unknown handler failures.
Controls preservation of unknown request fields. Enable only at trusted forwarding boundaries.
Sets the maximum raw request size in bytes. The default is 4,194,304.
Sets the JavaScript URL loaded by the RPC Studio page.
Types
@type handler() :: (term(), term() -> {:ok, term()} | {:error, Skir.RPC.ServiceError.t() | Skir.RPC.UnknownError.t()})
Functions
@spec add_method(t(), Skir.Method.t(), handler()) :: t()
Registers a method and an arity-2 handler receiving the decoded request and metadata. Duplicate method numbers raise ArgumentError.
@spec handle_request(t(), binary(), term()) :: Skir.RPC.RawResponse.t()
Dispatches a raw SkirRPC payload, list, or studio and returns a Skir.RPC.RawResponse. Metadata is passed to the handler.
Creates a service. Options configure unknown fields, error disclosure/logging, Studio, and request size.
@spec set_can_send_unknown_error_message( t(), boolean() | (Skir.RPC.ErrorInfo.t() -> boolean()) ) :: t()
Controls whether internal error messages reach clients, using a boolean or an ErrorInfo predicate. Default: hidden.
@spec set_error_logger(t(), (Skir.RPC.ErrorInfo.t() -> term())) :: t()
Sets the callback receiving Skir.RPC.ErrorInfo for controlled and unknown handler failures.
Controls preservation of unknown request fields. Enable only at trusted forwarding boundaries.
@spec set_max_request_bytes(t(), pos_integer()) :: t()
Sets the maximum raw request size in bytes. The default is 4,194,304.
Sets the JavaScript URL loaded by the RPC Studio page.