WebSocket transport support for nREPL, server side.
Unlike the HTTP long-poll transport in drawbridge.core, a
WebSocket connection lets the server push nREPL responses as they
are produced -- no polling, no per-request session cookies, and a
connection maps naturally onto a stateful nREPL client. Prefer this
transport when your deployment environment allows WebSocket
upgrades; keep the HTTP transport as a fallback for environments
that don't.
Messages are JSON-encoded text frames in both directions, one nREPL message per frame.
See drawbridge.websocket-client for the matching client-side
transport.
WebSocket transport support for nREPL, server side. Unlike the HTTP long-poll transport in `drawbridge.core`, a WebSocket connection lets the server push nREPL responses as they are produced -- no polling, no per-request session cookies, and a connection maps naturally onto a stateful nREPL client. Prefer this transport when your deployment environment allows WebSocket upgrades; keep the HTTP transport as a fallback for environments that don't. Messages are JSON-encoded text frames in both directions, one nREPL message per frame. See `drawbridge.websocket-client` for the matching client-side transport.
(ring-handler &
{:keys [nrepl-handler fallback ping-interval-ms]
:or {nrepl-handler (server/default-handler)
fallback (constantly upgrade-required-response)
ping-interval-ms 30000}})Returns a Ring handler implementing a WebSocket transport endpoint for nREPL. Requires a Ring adapter with WebSocket support (e.g. ring-jetty-adapter 1.11+).
Each WebSocket connection gets its own transport; incoming text frames are JSON-decoded and dispatched to the nREPL handler, and every response is pushed back as a JSON text frame as soon as it is produced.
Options:
(nrepl.server/default-handler))drawbridge.core/ring-handler
(default: respond with 426 Upgrade Required)No param middleware is needed, in contrast to
drawbridge.core/ring-handler.
Returns a Ring handler implementing a WebSocket transport endpoint
for nREPL. Requires a Ring adapter with WebSocket support (e.g.
ring-jetty-adapter 1.11+).
Each WebSocket connection gets its own transport; incoming text
frames are JSON-decoded and dispatched to the nREPL handler, and
every response is pushed back as a JSON text frame as soon as it
is produced.
Options:
* :nrepl-handler -- a custom nREPL handler
(default: `(nrepl.server/default-handler)`)
* :fallback -- a Ring handler for plain HTTP requests, letting
one route serve both this transport and the HTTP long-poll
transport of `drawbridge.core/ring-handler`
(default: respond with 426 Upgrade Required)
* :ping-interval-ms -- how often to send a keepalive ping on
each connection, preventing proxies and routers from dropping
idle REPL sessions (default 30000; 0 disables)
No param middleware is needed, in contrast to
`drawbridge.core/ring-handler`.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 |