A local nREPL bridge for Drawbridge HTTP endpoints.
Most nREPL clients (CIDER, Calva, Conjure, rebel-readline, nREPL's own command line) speak bencode over a plain socket and cannot talk to a Drawbridge HTTP endpoint directly. This namespace runs a small local socket server that accepts those connections and relays every message to a remote Drawbridge endpoint over HTTP(S), pushing the responses back. Each local connection gets its own HTTP session on the remote end, so concurrent clients stay isolated.
Command-line usage:
clojure -M -m drawbridge.bridge --url https://my-app.example.com/repl \
--port 7888 --token $DRAWBRIDGE_TOKEN
...then point any nREPL client at localhost:7888.
For http(s) URLs, responses are fetched by polling the endpoint
(see drawbridge.client for the throttling details), so output
arrives with up to ~100ms of latency. For ws(s) URLs the bridge
speaks the WebSocket transport (drawbridge.websocket-client)
instead, and responses are pushed with no polling delay.
A local nREPL bridge for Drawbridge HTTP endpoints.
Most nREPL clients (CIDER, Calva, Conjure, rebel-readline, nREPL's
own command line) speak bencode over a plain socket and cannot talk
to a Drawbridge HTTP endpoint directly. This namespace runs a small
local socket server that accepts those connections and relays every
message to a remote Drawbridge endpoint over HTTP(S), pushing the
responses back. Each local connection gets its own HTTP session on
the remote end, so concurrent clients stay isolated.
Command-line usage:
clojure -M -m drawbridge.bridge --url https://my-app.example.com/repl \
--port 7888 --token $DRAWBRIDGE_TOKEN
...then point any nREPL client at localhost:7888.
For http(s) URLs, responses are fetched by polling the endpoint
(see `drawbridge.client` for the throttling details), so output
arrives with up to ~100ms of latency. For ws(s) URLs the bridge
speaks the WebSocket transport (`drawbridge.websocket-client`)
instead, and responses are pushed with no polling delay.(-main & args)Command-line entry point. See usage (or run with --help) for the
accepted arguments. The bearer token can also be supplied via the
DRAWBRIDGE_TOKEN environment variable, which is preferable to
--token since arguments are visible in the process list.
Command-line entry point. See `usage` (or run with --help) for the accepted arguments. The bearer token can also be supplied via the DRAWBRIDGE_TOKEN environment variable, which is preferable to --token since arguments are visible in the process list.
(start-bridge
{:keys [url port bind http-headers] :or {port 0 bind "127.0.0.1"} :as opts})Start a local nREPL socket server that bridges to the Drawbridge
endpoint at :url.
Options:
:url (required) -- the remote Drawbridge endpoint,
e.g. "https://my-app.example.com/repl":port -- local port to listen on (default 0, i.e. a free port):bind -- local address to bind (default "127.0.0.1"):http-headers -- extra HTTP headers to send with every request,
e.g. {"Authorization" "Bearer <token>"}:active-poll-ms, :idle-poll-ms, :idle-after-ms -- pacing of
the remote polling loop (see default-poll-opts)Returns a map with :port (the bound local port) and :server;
pass it to stop-bridge to shut down.
Start a local nREPL socket server that bridges to the Drawbridge
endpoint at `:url`.
Options:
* `:url` (required) -- the remote Drawbridge endpoint,
e.g. "https://my-app.example.com/repl"
* `:port` -- local port to listen on (default 0, i.e. a free port)
* `:bind` -- local address to bind (default "127.0.0.1")
* `:http-headers` -- extra HTTP headers to send with every request,
e.g. {"Authorization" "Bearer <token>"}
* `:active-poll-ms`, `:idle-poll-ms`, `:idle-after-ms` -- pacing of
the remote polling loop (see `default-poll-opts`)
Returns a map with `:port` (the bound local port) and `:server`;
pass it to `stop-bridge` to shut down.(stop-bridge {:keys [server connections]})Stop a bridge started with start-bridge, closing the listening
socket and any open connections.
Stop a bridge started with `start-bridge`, closing the listening socket and any open connections.
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 |