Ring 1.15 WebSocket upgrade handler for boundary-realtime.
Bridges Ring's map-based Listener (::ring.websocket/listener response) to the IRealtimeService connect/disconnect lifecycle.
Usage: (require '[boundary.realtime.shell.handlers.ring-websocket :as ws-handler])
;; In your route definitions {:path "/ws" :methods {:get {:handler (ws-handler/websocket-handler realtime-service)}}}
Ring 1.15 WebSocket upgrade handler for boundary-realtime.
Bridges Ring's map-based Listener (::ring.websocket/listener response)
to the IRealtimeService connect/disconnect lifecycle.
Usage:
(require '[boundary.realtime.shell.handlers.ring-websocket :as ws-handler])
;; In your route definitions
{:path "/ws"
:methods {:get {:handler (ws-handler/websocket-handler realtime-service)}}}(websocket-handler realtime-service
&
{:keys [token-param on-message] :or {token-param "token"}})Returns a Ring handler that upgrades GET requests to WebSocket.
Expects a token query parameter for JWT authentication.
The token is verified via the realtime-service's JWT verifier
during the connect handshake.
Lifecycle: on-open → creates adapter, calls realtime-ports/connect (JWT auth) on-message → no-op (override with :on-message opt for bidirectional) on-close → calls realtime-ports/disconnect on-error → calls realtime-ports/disconnect
Args: realtime-service - IRealtimeService implementation
Options (keyword args): :token-param - query param name for JWT (default "token") :on-message - optional (fn [ws-socket message]) for client→server
Returns: Ring handler fn that returns a ::ring.websocket/listener response
Returns a Ring handler that upgrades GET requests to WebSocket. Expects a `token` query parameter for JWT authentication. The token is verified via the realtime-service's JWT verifier during the connect handshake. Lifecycle: on-open → creates adapter, calls realtime-ports/connect (JWT auth) on-message → no-op (override with :on-message opt for bidirectional) on-close → calls realtime-ports/disconnect on-error → calls realtime-ports/disconnect Args: realtime-service - IRealtimeService implementation Options (keyword args): :token-param - query param name for JWT (default "token") :on-message - optional (fn [ws-socket message]) for client→server Returns: Ring handler fn that returns a ::ring.websocket/listener 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 |