JSONRPC2 v2.0.0 JSONRPC2.Servers.HTTP View Source

An HTTP server which responds to POSTed JSON-RPC 2.0 in the request body.

This server will respond to all requests on the given port. If you wish to mount a JSON-RPC 2.0 handler within a Plug-based web app (such as Phoenix), please see JSONRPC2.Servers.HTTP.Plug.

Link to this section Summary

Functions

Returns a supervisor child spec for the given handler via scheme with cowboy_opts.

Starts an HTTP server for the given handler with cowboy_opts.

Starts an HTTPS server for the given handler with cowboy_opts.

Shut down an existing server with given ref.

Link to this section Functions

Link to this function

child_spec(scheme, handler, cowboy_opts \\ [])

View Source

Specs

child_spec(:http | :https, module(), list()) :: Supervisor.Spec.spec()

Returns a supervisor child spec for the given handler via scheme with cowboy_opts.

Allows you to embed a server directly in your app's supervision tree, rather than letting Plug/Cowboy handle it.

Please see the docs for Plug.Cowboy for the values which are allowed in cowboy_opts.

If the server ref is not set in cowboy_opts, handler.HTTP or handler.HTTPS is the default.

Link to this function

http(handler, cowboy_opts \\ [])

View Source

Specs

http(module(), list()) :: {:ok, pid()} | {:error, term()}

Starts an HTTP server for the given handler with cowboy_opts.

Please see the docs for Plug.Cowboy for the values which are allowed in cowboy_opts.

If the server ref is not set in cowboy_opts, handler.HTTP is the default.

Link to this function

https(handler, cowboy_opts \\ [])

View Source

Specs

https(module(), list()) :: {:ok, pid()} | {:error, term()}

Starts an HTTPS server for the given handler with cowboy_opts.

Please see the docs for Plug.Cowboy for the values which are allowed in cowboy_opts. In addition to the normal cowboy_opts, this function also accepts the same extra SSL-related options as Plug.Cowboy.https/3.

If the server ref is not set in cowboy_opts, handler.HTTPS is the default.

Specs

shutdown(atom()) :: :ok | {:error, :not_found}

Shut down an existing server with given ref.