Subscriptions represent ongoing or delayed self-messages owned by an app.
The server reconciles subscriptions after each state transition, diffing by
stable id so applications can declare timers without manually managing
Process.send_after/3 references.
Available subscription constructors:
interval/3— repeated self-message at a fixed intervalonce/3— one-shot self-message delivered once after a delay
Reducer apps declare subscriptions by implementing subscriptions/1.
Summary
Functions
Declares a repeating self-message subscription.
Returns an empty subscription list.
Declares a one-shot self-message subscription.
Types
@type kind() :: :interval | :once
@type t() :: %ExRatatui.Subscription{ id: term(), interval_ms: pos_integer(), kind: kind(), message: term() }
Functions
@spec interval(term(), pos_integer(), term()) :: t()
Declares a repeating self-message subscription.
id should be stable across renders for the same logical subscription so the
runtime can keep it armed instead of cancelling and recreating it.
@spec none() :: []
Returns an empty subscription list.
Useful when subscriptions/1 or helper functions want to return an explicit
"no subscriptions" value.
@spec once(term(), pos_integer(), term()) :: t()
Declares a one-shot self-message subscription.
Like interval/3, id is used for reconciliation. Once the message fires,
the subscription stays inactive until your app returns it again.