JSONRPC2 v0.3.0 JSONRPC2.Servers.HTTP

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.

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

Functions

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

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

http(handler, cowboy_opts \\ [])

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 for the values which are allowed in cowboy_opts.

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

https(handler, cowboy_opts \\ [])

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 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.Adapters.Cowboy.https/3.

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

shutdown(ref)

Specs

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

Shut down an existing server with given ref.