Liking cljdoc? Tell your friends :D

zodiac.ext.live

Zodiac extension for remuda + darkstar.

The core is plain Ring and knows nothing about zodiac; this namespace is the wiring, following the shape of zodiac-hot-reload: integrant keys, route registration, and a config transformer. No domain logic. If this file grows past wiring, 's map-of-pieces design has failed.

Usage:

(z/start {:extensions [(z.live/init {:components {:chat #'app/chat}
                                     :render-fn chassis/html
                                     :source my-source
                                     :secret "..."})]})

What it wires:

  • the engine, the pubsub bus and registry, and the fragment cache as integrant components, so they participate in zodiac's lifecycle;
  • an SSE route and an action route;
  • the flush loop that turns coalesced hints into pushes.

Components are registered as vars, deliberately

Redefining :render at a REPL must reach already-connected contexts. The engine resolves a component by name on every render and derefs it if it is deref-able, so an adapter should register vars#'app/chat, not app/chat. A plain map still works but only whole-map replacement is visible.

Registries survive reload

The live-context registry, subscription registry and cache are held in defonced atoms rather than created per init-key, because requires them to survive tools.namespace/refresh. Recreating them on reload would drop every connection — the same failure as a server restart, triggered by saving a file.

Zodiac extension for remuda + darkstar.

The core is plain Ring and knows nothing about zodiac; this
namespace is the wiring, following the shape of `zodiac-hot-reload`: integrant
keys, route registration, and a config transformer. **No domain logic.** If this
file grows past wiring, 's map-of-pieces design has failed.

Usage:

    (z/start {:extensions [(z.live/init {:components {:chat #'app/chat}
                                         :render-fn chassis/html
                                         :source my-source
                                         :secret "..."})]})

What it wires:

- the engine, the pubsub bus and registry, and the fragment cache as integrant
  components, so they participate in zodiac's lifecycle;
- an SSE route and an action route;
- the flush loop that turns coalesced hints into pushes.

## Components are registered as vars, deliberately

Redefining `:render` at a REPL must reach already-connected
contexts. The engine resolves a component by name on every render and derefs it
if it is deref-able, so **an adapter should register vars** — `#'app/chat`, not
`app/chat`. A plain map still works but only whole-map replacement is visible.

## Registries survive reload

The live-context registry, subscription registry and cache are held in
`defonce`d atoms rather than created per `init-key`, because  requires them
to survive `tools.namespace/refresh`. Recreating them on reload would drop every
connection — the same failure as a server restart, triggered by saving a file.
raw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close