Fix scittle.nrepl to honor SCITTLE_NREPL_WEBSOCKET_PORT

Add (deref (promise)) to doc/nrepl/bb.edn:http-server
This commit is contained in:
Srijayanth Sridhar 2022-10-18 19:31:40 +05:30
parent 12e5a33964
commit 20e125dd6c
No known key found for this signature in database
GPG key ID: 9B48B4F632B1EFA8
2 changed files with 7 additions and 3 deletions

View file

@ -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))
(let [ws-port (or (.-SCITTLE_NREPL_WEBSOCKET_PORT js/window) 1340)]
(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)