Fix scittle.nrepl to honor SCITTLE_NREPL_WEBSOCKET_PORT (#45)
This commit is contained in:
parent
12e5a33964
commit
693d6ff8c2
|
@ -1,5 +1,9 @@
|
|||
# Changelog
|
||||
|
||||
## Unreleased
|
||||
|
||||
- Fix for [44](https://github.com/babashka/scittle/issues/44): Honoring `SCITTLE_NREPL_WEBSOCKET_PORT` in `scittle.nrepl`
|
||||
|
||||
## v0.3.10
|
||||
|
||||
- Add `scittle.promesa.js` plugin. This gives access to the [promesa](https://cljdoc.org/d/funcool/promesa/8.0.450/doc/user-guide) library.
|
||||
|
|
|
@ -31,9 +31,12 @@
|
|||
:complete (let [completions (completions (assoc msg :ctx @!sci-ctx))]
|
||||
(nrepl-reply msg completions))))
|
||||
|
||||
(when (.-SCITTLE_NREPL_WEBSOCKET_PORT js/window)
|
||||
(defn ws-url [host port path]
|
||||
(str "ws://" host ":" port "/" path))
|
||||
|
||||
(when-let [ws-port (.-SCITTLE_NREPL_WEBSOCKET_PORT js/window)]
|
||||
(set! (.-ws_nrepl js/window)
|
||||
(new js/WebSocket "ws://localhost:1340/_nrepl")))
|
||||
(new js/WebSocket (ws-url "localhost" ws-port "_nrepl"))))
|
||||
|
||||
(when-let [ws (nrepl-websocket)]
|
||||
(prn :ws ws)
|
||||
|
|
Loading…
Reference in a new issue