View Source Tamnoon (Tamnoon v0.1.0)

This module provides functions needed to initialize Tamnoon. You do not need to handle it directly, rather, the only time you need to call something in this module is in your supervision tree, to add it to the children and configure it (see child_spec/1).

Example

def start_link(opts \\ []) do
  children = [Tamnoon]
  opts = [strategy: :one_for_one, name: Tamnoon.Supervisor]
  Supervisor.start_link(children, opts)
end

Summary

Types

Options for initializing Tamnoon. Defaults to [4000, Tamnoon.Router, Tamnoon.SocketHandler, Tamnoon.Methods, %{}].

Functions

Returns a Tamnoon server supervisor child spec. See tamnoon_opts/0 for more info.

Starts the supervisor. See tamnoon_opts/0 for more info.

Types

@type tamnoon_opts() :: [
  port: number(),
  router: module(),
  socket_handler: module(),
  methods_module: module(),
  initial_state: map()
]

Options for initializing Tamnoon. Defaults to [4000, Tamnoon.Router, Tamnoon.SocketHandler, Tamnoon.Methods, %{}].

Functions

@spec child_spec(opts :: tamnoon_opts()) :: map()

Returns a Tamnoon server supervisor child spec. See tamnoon_opts/0 for more info.

@spec start_link(server_opts :: tamnoon_opts()) ::
  {:ok, pid()}
  | {:error, {:already_started, pid()} | {:shutdown, term()} | term()}

Starts the supervisor. See tamnoon_opts/0 for more info.