HTTP + WebSocket serving via http-kit — a JVM mirror of bun.server.
WebSocket pub/sub is hand-tracked per topic in an atom (http-kit has no
built-in topics). See docs/MIRROR.md.
HTTP + WebSocket serving via http-kit — a JVM mirror of `bun.server`. WebSocket pub/sub is hand-tracked per topic in an atom (http-kit has no built-in topics). See `docs/MIRROR.md`.
(publish! {:keys [topics]} topic message)Sends message to every WebSocket channel subscribed to topic. Returns the count.
Sends message to every WebSocket channel subscribed to topic. Returns the count.
(start! {:keys [port hostname fetch] :or {port 0 hostname "0.0.0.0"}})Starts an HTTP server. opts: :port (0=random), :hostname (default "0.0.0.0"), :fetch (fn [req handle] -> ring-response). Returns {:native stop-fn :port int :hostname str :url "http://host:port" :topics atom}. Throws {:type :server-error :reason :port-in-use|:start-failed …} on bind failure.
Starts an HTTP server. opts: :port (0=random), :hostname (default "0.0.0.0"),
:fetch (fn [req handle] -> ring-response). Returns
{:native stop-fn :port int :hostname str :url "http://host:port" :topics atom}.
Throws {:type :server-error :reason :port-in-use|:start-failed …} on bind failure.(stop! {:keys [native]})Stops the server synchronously. Returns nil.
Stops the server synchronously. Returns nil.
(upgrade! handle req topic)(upgrade! {:keys [topics] :as _handle} req topic initial-fn)Upgrades req to a WebSocket subscribed to topic. With initial-fn, sends
(initial-fn) to the new channel on open when it returns non-nil. Returns the
as-channel response.
Upgrades req to a WebSocket subscribed to `topic`. With initial-fn, sends (initial-fn) to the new channel on open when it returns non-nil. Returns the as-channel response.
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 |