Realtime service implementation (Shell layer).
Orchestrates WebSocket messaging between core logic and adapters. Implements the imperative shell in the FC/IS architecture pattern.
Responsibilities (Shell/I/O):
Does NOT contain:
Realtime service implementation (Shell layer). Orchestrates WebSocket messaging between core logic and adapters. Implements the imperative shell in the FC/IS architecture pattern. Responsibilities (Shell/I/O): - WebSocket connection lifecycle (open, close) - JWT authentication (delegates to the injected IJWTVerifier) - Message routing (publishes envelopes onto the message bus) - Connection registry management - Pub/sub topic management - Logging and error handling Does NOT contain: - Business logic (lives in core.*) - Database operations (no persistence needed for WebSockets) - Message validation logic (lives in core.message)
(acquire-stream! svc)Take one of the node's SSE stream slots; false when all are taken. A service without slots (another IRealtimeService) is uncapped.
Take one of the node's SSE stream slots; false when all are taken. A service without slots (another IRealtimeService) is uncapped.
(create-realtime-service connection-registry
jwt-verifier
&
{:keys [pubsub-manager logger error-reporter bus
max-streams]})Create realtime service for WebSocket messaging.
Options: :pubsub-manager IPubSubManager (optional, for topic support) :logger logger instance (optional) :error-reporter error reporter (optional) :bus IMessageBus (optional; defaults to a fresh InMemoryMessageBus for single-node use) :max-streams concurrent SSE streams on this node, default 32 — each holds a server thread, and Jetty's pool defaults to 50
On construction the service registers a node-local delivery-fn with the bus (start-subscriber!). Pass a shared bus to two services to relay between them.
Create realtime service for WebSocket messaging.
Options:
:pubsub-manager IPubSubManager (optional, for topic support)
:logger logger instance (optional)
:error-reporter error reporter (optional)
:bus IMessageBus (optional; defaults to a fresh
InMemoryMessageBus for single-node use)
:max-streams concurrent SSE streams on this node, default 32 — each
holds a server thread, and Jetty's pool defaults to 50
On construction the service registers a node-local delivery-fn with the bus
(start-subscriber!). Pass a shared bus to two services to relay between them.(with-clean-error-context svc f)Run f with the error context of svc's :error-reporter empty, then put
back what was there (BOU-848).
Run `f` with the error context of `svc`'s `:error-reporter` empty, then put back what was there (BOU-848).
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 |