One-shot retrieval of cached messages — the poll=1 mode of the subscribe
API (reference §2.1–§2.2). Usually called through the ExNtfy facade.
Polling is a plain request/response: the server returns cached messages as ndjson and closes the connection. Long-lived streaming subscriptions are separate (Phase 6).
Telemetry
Every poll is wrapped in :telemetry.span/3, emitting
[:ex_ntfy, :poll, :start | :stop | :exception] with metadata
%{topics: topics, base_url: base_url} — never credentials or message
contents.
Summary
Functions
Fetches cached messages: GET /<topics>/json?poll=1.
Same as poll/2, but returns the message list directly and raises
ExNtfy.Error on failure.
Functions
@spec poll( ExNtfy.Subscribe.Options.topics(), keyword() ) :: {:ok, [ExNtfy.Message.t()]} | {:error, ExNtfy.Error.t()}
Fetches cached messages: GET /<topics>/json?poll=1.
topics is a string or list of strings (joined with commas in the path).
Options are the subscribe options (see ExNtfy.Subscribe.Options) plus any
client options; the default window is since: :all server-side.
Returns messages in the order the server sent them. open/keepalive
events are dropped from the result (poll responses normally contain only
cached message events anyway); unparsable ndjson lines are skipped with a
Logger warning rather than failing the whole poll.
@spec poll!( ExNtfy.Subscribe.Options.topics(), keyword() ) :: [ExNtfy.Message.t()]
Same as poll/2, but returns the message list directly and raises
ExNtfy.Error on failure.