Pure functions for WebSocket authentication logic.
Following FC/IS pattern - all functions are pure (no I/O). JWT token extraction and validation logic. Actual JWT verification delegated to shell/ports.
Pure functions for WebSocket authentication logic. Following FC/IS pattern - all functions are pure (no I/O). JWT token extraction and validation logic. Actual JWT verification delegated to shell/ports.
Pure functions for WebSocket connection state management.
Following FC/IS pattern - all functions are pure (no I/O). Connection lifecycle and authorization logic.
Pure functions for WebSocket connection state management. Following FC/IS pattern - all functions are pure (no I/O). Connection lifecycle and authorization logic.
Pure functions for WebSocket message validation and routing.
Following FC/IS pattern - all functions are pure (no I/O). Message creation, validation, and routing logic.
Pure functions for WebSocket message validation and routing. Following FC/IS pattern - all functions are pure (no I/O). Message creation, validation, and routing logic.
Pure functions for pub/sub topic management.
Implements topic-based message routing where connections can subscribe to topics and receive messages published to those topics. All functions are pure (no I/O, no side effects) following FC/IS pattern.
Key Features:
Data Structure: Subscriptions are represented as a map: {topic-name #{connection-id-1 connection-id-2 ...}}
Pure functions for pub/sub topic management.
Implements topic-based message routing where connections can subscribe to
topics and receive messages published to those topics. All functions are pure
(no I/O, no side effects) following FC/IS pattern.
Key Features:
- Subscribe connection to topic (add to subscription set)
- Unsubscribe connection from topic (remove from set)
- Find all subscribers for topic (set intersection)
- Clean up subscriptions on disconnect (remove all for connection)
Data Structure:
Subscriptions are represented as a map:
{topic-name #{connection-id-1 connection-id-2 ...}}Port definitions for real-time WebSocket communication.
This module defines protocols for WebSocket-based messaging, similar to Phoenix Channels (Elixir) or Socket.io (Node.js). Supports point-to-point, broadcast, and role-based messaging with JWT authentication.
Key Features:
Port definitions for real-time WebSocket communication. This module defines protocols for WebSocket-based messaging, similar to Phoenix Channels (Elixir) or Socket.io (Node.js). Supports point-to-point, broadcast, and role-based messaging with JWT authentication. Key Features: - WebSocket connection management - Message routing (user, role, broadcast, connection-specific) - JWT-based authentication - Connection registry (in-memory or Redis)
Malli schemas for realtime module data structures.
Schemas for:
Malli schemas for realtime module data structures. Schemas for: - Connection state - WebSocket messages - Authentication tokens - Routing metadata - Pub/sub topics and subscriptions
JWT verification adapter that delegates to boundary/user module.
Wraps boundary.user.shell.auth/validate-jwt-token to provide IJWTVerifier protocol implementation. Avoids direct dependency from core layer to user module.
Responsibilities (Shell/I/O):
JWT verification adapter that delegates to boundary/user module. Wraps boundary.user.shell.auth/validate-jwt-token to provide IJWTVerifier protocol implementation. Avoids direct dependency from core layer to user module. Responsibilities (Shell/I/O): - Call user module for JWT verification (I/O - external dependency) - Transform user module response to expected format - Handle verification errors
WebSocket connection adapter for Ring/Jetty.
Wraps Ring WebSocket implementation to provide IWebSocketConnection protocol. Handles JSON encoding/decoding and WebSocket frame transmission.
Responsibilities (Shell/I/O):
WebSocket connection adapter for Ring/Jetty. Wraps Ring WebSocket implementation to provide IWebSocketConnection protocol. Handles JSON encoding/decoding and WebSocket frame transmission. Responsibilities (Shell/I/O): - Send messages over WebSocket (I/O operation) - Close WebSocket connections (I/O operation) - JSON encoding (external format transformation) - Error handling and logging
In-memory connection registry implementation.
Stores active WebSocket connections in an atom for single-server deployments. For multi-server scaling, swap with Redis-backed registry implementation.
Registry Structure: {connection-id {:connection <Connection record> :ws-adapter <IWebSocketConnection>}}
Responsibilities (Shell/I/O):
In-memory connection registry implementation.
Stores active WebSocket connections in an atom for single-server deployments.
For multi-server scaling, swap with Redis-backed registry implementation.
Registry Structure:
{connection-id {:connection <Connection record>
:ws-adapter <IWebSocketConnection>}}
Responsibilities (Shell/I/O):
- Store and retrieve connection mappings (stateful atom)
- Filter connections by user-id, role (uses core filtering functions)
- Thread-safe updates (atom swap operations)In-memory pub/sub topic management (imperative shell).
Implements IPubSubManager protocol using atom-based subscription storage. Coordinates between pure pub/sub core functions and stateful subscription management.
Single-server implementation - subscriptions stored in memory. For multi-server deployments, would need Redis-backed implementation (v0.2.0).
Thread-safe via atom swap operations.
In-memory pub/sub topic management (imperative shell). Implements IPubSubManager protocol using atom-based subscription storage. Coordinates between pure pub/sub core functions and stateful subscription management. Single-server implementation - subscriptions stored in memory. For multi-server deployments, would need Redis-backed implementation (v0.2.0). Thread-safe via atom swap operations.
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 user module) - Message routing (uses core routing logic) - 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)
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 |