AdaSdk.StreamHub (ada_sdk v0.0.1)

Copy Markdown View Source

Summary

Functions

Returns a specification to start this module under a supervisor.

Types

config()

@type config() :: %{
  client: pid(),
  kind: :events | :signals | :jobs,
  events: MapSet.t(atom()),
  open_stream: (String.t() -> {:ok, Enumerable.t()} | {:error, term()}),
  decode: (struct() -> decode_result()),
  options: keyword()
}

decode_result()

@type decode_result() ::
  {:ok, String.t(), atom(), struct(), String.t()} | {:error, String.t()}

unsubscribe()

@type unsubscribe() :: (-> :ok)

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

close(hub)

@spec close(pid()) :: :ok

on(hub, principal_id, event, handler)

@spec on(pid(), String.t(), atom(), function()) ::
  {:ok, unsubscribe()} | {:error, :invalid_event | :invalid_handler | :closed}

start_link(config)

@spec start_link(config()) :: GenServer.on_start()