Use window.location.hostname for WebSocket connection (#49)

* Use window.location.hostname for WebSocket connection

* Update CHANGELOG
This commit is contained in:
Michael Camilleri 2023-01-21 02:57:33 +09:00 committed by GitHub
parent 151ea479f3
commit 57536819c3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View file

@ -2,6 +2,10 @@
[Scittle](https://github.com/babashka/scittle): execute Clojure(Script) directly from browser script tags via SCI!
## Unreleased
- Use `window.location.hostname` for WebSocket connection
## v0.5.14 (2023-01-05)
- Fix destructuring in `defmethod` (by upgrading SCI)

View file

@ -36,7 +36,7 @@
(when-let [ws-port (.-SCITTLE_NREPL_WEBSOCKET_PORT js/window)]
(set! (.-ws_nrepl js/window)
(new js/WebSocket (ws-url "localhost" ws-port "_nrepl"))))
(new js/WebSocket (ws-url (.-hostname (.-location js/window)) ws-port "_nrepl"))))
(when-let [ws (nrepl-websocket)]
(prn :ws ws)