SSE listener for the Synthigy CLJS client.
Uses fetch streaming (ReadableStream + TextDecoder) — supports
Authorization headers, matches sdk/js. Callback-driven: caller
provides on-event; listen returns a 0-arg stop function that
aborts the connection.
Auto-reconnects with Last-Event-ID + exponential backoff (1s → 30s).
SSE listener for the Synthigy CLJS client. Uses fetch streaming (ReadableStream + TextDecoder) — supports Authorization headers, matches sdk/js. Callback-driven: caller provides `on-event`; `listen` returns a 0-arg `stop` function that aborts the connection. Auto-reconnects with Last-Event-ID + exponential backoff (1s → 30s).
(listen on-event)(listen on-event
{:keys [max-delay on-parse-error on-connect]
:or {max-delay 30000 on-parse-error default-on-parse-error}})Stream SSE notifications from /data/events, calling on-event with
each {:type :entity :relations :xids} notification.
Returns a 0-arg function that stops the listener (aborts the fetch, halts reconnect loop).
Options: :max-delay — cap for reconnect backoff ms (default 30000) :on-parse-error — (fn [error raw]) for malformed frames (default logs to console.warn) :on-connect — 0-arg fn called after every successful (re)connect — used to re-assert server-side state (e.g. re-POST the subscription set, which may have been lost/replaced while disconnected). Exceptions are swallowed.
UNAUTHORIZED / FORBIDDEN propagate (no reconnect); other transport errors trigger reconnect with backoff.
Stream SSE notifications from /data/events, calling `on-event` with
each `{:type :entity :relations :xids}` notification.
Returns a 0-arg function that stops the listener (aborts the fetch,
halts reconnect loop).
Options:
:max-delay — cap for reconnect backoff ms (default 30000)
:on-parse-error — (fn [error raw]) for malformed frames
(default logs to console.warn)
:on-connect — 0-arg fn called after every successful (re)connect —
used to re-assert server-side state (e.g. re-POST the
subscription set, which may have been lost/replaced
while disconnected). Exceptions are swallowed.
UNAUTHORIZED / FORBIDDEN propagate (no reconnect); other transport
errors trigger reconnect with backoff.cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |