(set-auth-token-injector! f)Registers (fn [request token] -> request); nil restores the Bearer default.
Registers `(fn [request token] -> request)`; nil restores the Bearer default.
(set-auth-token-provider! f)Registers a 0-arg fn that returns the current access token (or nil).
Registers a 0-arg fn that returns the current access token (or nil).
(subscribe api-name
endpoint-name
{:keys [path-params params on-open on-message on-error events]
:as _opts})Opens an SSE subscription against an endpoint declared :method :sse.
The stream is a fetch whose body is read as it arrives and parsed by sse/feed. Each
(re)open rebuilds the request, so the token is re-read from auth-token-provider and put
on by the registered injector every time. What happens next is decided by
sse/response-action: 200 + text/event-stream opens; a 401 token-stale reloads the
token and re-opens; any other 401 ends the session (the unauthorized handler, no
re-open); anything else — another status, a network error, the stream ending — re-opens
on the backoff, never faster than the server's retry:.
Opens an SSE subscription against an endpoint declared `:method :sse`. The stream is a `fetch` whose body is read as it arrives and parsed by `sse/feed`. Each (re)open rebuilds the request, so the token is re-read from `auth-token-provider` and put on by the registered injector every time. What happens next is decided by `sse/response-action`: 200 + text/event-stream opens; a 401 `token-stale` reloads the token and re-opens; any other 401 ends the session (the unauthorized handler, no re-open); anything else — another status, a network error, the stream ending — re-opens on the backoff, never faster than the server's `retry:`.
(unsubscribe! handle)Aborts the stream's connection and cancels any pending reconnect. Anything that is not a
Subscription — the reaction execute returns for a plain request, nil — is a no-op, so
a component can unsubscribe! whatever execute gave it without knowing the method.
Aborts the stream's connection and cancels any pending reconnect. Anything that is not a `Subscription` — the reaction `execute` returns for a plain request, nil — is a no-op, so a component can `unsubscribe!` whatever `execute` gave it without knowing the method.
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 |