Standalone http-kit lifecycle around a default stube kernel.
Two concerns live here:
start!, stop!, mount!, unmount!, plus the
per-conversation reaper that runs alongside the listener.default-kernel,
conversation, active-conversations, end!, publish!,
inspect. These all delegate to dev.zeko.stube.runtime with
the process-global kernel value.Adapters and tests that already have a kernel in hand should call
dev.zeko.stube.runtime directly — this namespace is for the
greenfield (s/start!) + (s/mount!) workflow.
The mutable conversation/SSE/timer state lives on the kernel value
returned by dev.zeko.stube.embed/make-kernel (a thin public
facade over dev.zeko.stube.runtime/make-kernel).
Standalone http-kit lifecycle around a default stube kernel. Two concerns live here: * The lifecycle: `start!`, `stop!`, `mount!`, `unmount!`, plus the per-conversation reaper that runs alongside the listener. * The default-kernel convenience surface: `default-kernel`, `conversation`, `active-conversations`, `end!`, `publish!`, `inspect`. These all delegate to `dev.zeko.stube.runtime` with the process-global kernel value. Adapters and tests that already have a kernel in hand should call [[dev.zeko.stube.runtime]] directly — this namespace is for the greenfield `(s/start!)` + `(s/mount!)` workflow. The mutable conversation/SSE/timer state lives on the kernel value returned by [[dev.zeko.stube.embed/make-kernel]] (a thin public facade over [[dev.zeko.stube.runtime/make-kernel]]).
(active-conversations)Return a snapshot of all active conversations keyed by cid.
Return a snapshot of all active conversations keyed by cid.
(conversation cid)Snapshot of the named conversation in the standalone kernel, or nil.
Snapshot of the named conversation in the standalone kernel, or nil.
(default-kernel)The kernel instance used by the standalone server API.
The kernel instance used by the standalone server API.
(end! cid)Drop a conversation, its SSE binding, async state, and persisted copy.
Drop a conversation, its SSE binding, async state, and persisted copy.
(inspect cid)Pretty-print and return a compact summary of live conversation cid.
Pretty-print and return a compact summary of live conversation `cid`.
(mount! path flow-id)(mount! path flow-id opts)Register a flow at a URL path. After start!, GET <path> will
serve the shell page and pre-bind the resulting conversation to the
named flow.
Optional opts map is forwarded to the shell handler:
:init-args-fn — (fn [request] init-args-map). Extracts init-args
from the GET request (e.g. query params) to seed the component's initial
state. Example:
(s/mount! "/counter" :demo/counter
{:init-args-fn (fn [req]
{:n (parse-long (or (s/query-value req "n") "0"))})})
Register a flow at a URL path. After [[start!]], `GET <path>` will
serve the shell page and pre-bind the resulting conversation to the
named flow.
Optional `opts` map is forwarded to the shell handler:
* `:init-args-fn` — `(fn [request] init-args-map)`. Extracts init-args
from the GET request (e.g. query params) to seed the component's initial
state. Example:
(s/mount! "/counter" :demo/counter
{:init-args-fn (fn [req]
{:n (parse-long (or (s/query-value req "n") "0"))})})(publish! topic msg)Publish msg to every live instance subscribed to topic. From
inside a component dispatch this targets the active runtime kernel;
outside a dispatch it falls back to the standalone default kernel.
Publish `msg` to every live instance subscribed to `topic`. From inside a component dispatch this targets the active runtime kernel; outside a dispatch it falls back to the standalone default kernel.
Push kernel fragments to an open Datastar SSE generator.
Push kernel fragments to an open Datastar SSE generator.
(reset-state!)Wipe all standalone in-memory state. Intended for tests and REPL iteration.
Wipe all standalone in-memory state. Intended for tests and REPL iteration.
(start!)(start! {:keys [port store ui-css? base-css eager-scripts halos? app
principal-fn conversation-ttl reaper-interval]
:or
{port 8080 ui-css? true base-css [] eager-scripts [] halos? false}})Start http-kit on port (default 8080). Idempotent: a second call
with the server already running stops the old one first.
Accepts the embedder options :app and :principal-fn and forwards
them to the underlying kernel. See
dev.zeko.stube.embed/make-kernel for the full set.
Start http-kit on `port` (default 8080). Idempotent: a second call with the server already running stops the old one first. Accepts the embedder options `:app` and `:principal-fn` and forwards them to the underlying kernel. See [[dev.zeko.stube.embed/make-kernel]] for the full set.
(stop!)Stop the running server, if any. Runs the kernel shutdown sequence
ahead of closing the http-kit listener so :stop hooks fire, open
SSE streams receive a final :close, and the store is flushed
before the JVM exits.
Stop the running server, if any. Runs the kernel shutdown sequence ahead of closing the http-kit listener so `:stop` hooks fire, open SSE streams receive a final `:close`, and the store is flushed before the JVM exits.
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 |