View Source LiveAdmin.PubSub (LiveAdmin v1.0.0-rc.3)

PubSub system for exchanging messages with LiveAdmin.

Includes built in support for the following events:

* :job - Shows progress bar indicating status of any ongoing process. LiveAdmin uses this internally to indicate progress of actions on multiple records and tasks. Metadata consists of `pid`, `progress` float/int, and `label` string.
* :announce - Show temporary message with severity level. Meta consists of `message` string, and `type` (`:error`, `:success`, or `:info`)

Currently just a thin wrapper around Phoenix.PubSub, so its possible to use that directly, but discouraged since that may change.

Link to this section Summary

Functions

Add a message with status to alerts

Notify LiveAdmin of event, consisting of a unique name (either global or scoped to the session, if that is passed) and metadata.

Subscribe to all LiveAdmin events.

Subscribe to LiveAdmin events for a specific session.

Link to this section Types

Specs

data() :: Keyword.t()

Specs

message() :: String.t()

Specs

session_id() :: String.t()

Specs

status() :: :error | :success | :info

Link to this section Functions

Link to this function

announce(session_id \\ nil, status, message)

View Source

Specs

announce(session_id(), status(), message()) :: :ok

Add a message with status to alerts

Link to this function

broadcast(session_id \\ nil, event)

View Source

Specs

broadcast(
  session_id(),
  {atom(), map()}
) :: :ok

Notify LiveAdmin of event, consisting of a unique name (either global or scoped to the session, if that is passed) and metadata.

Specs

subscribe() :: :ok

Subscribe to all LiveAdmin events.

Specs

subscribe(session_id()) :: :ok

Subscribe to LiveAdmin events for a specific session.

Link to this function

update_job(session_id \\ nil, pid, data)

View Source

Specs

update_job(session_id(), pid(), data()) :: :ok

Update job progress