This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-01-20
Channels
- # adventofcode (8)
- # aleph (2)
- # announcements (10)
- # aws (5)
- # aws-lambda (2)
- # babashka (23)
- # beginners (23)
- # biff (9)
- # calva (4)
- # cider (8)
- # clj-kondo (21)
- # clojure (77)
- # clojure-boston (1)
- # clojure-dev (50)
- # clojure-europe (36)
- # clojure-gamedev (3)
- # clojure-nl (1)
- # clojure-norway (3)
- # clojure-spec (33)
- # clojure-uk (3)
- # clojurescript (22)
- # core-async (3)
- # cursive (10)
- # datahike (18)
- # datalevin (1)
- # datascript (9)
- # deps-new (21)
- # emacs (11)
- # events (1)
- # graphql (11)
- # guix (26)
- # java (7)
- # jobs (3)
- # lsp (12)
- # malli (6)
- # pathom (33)
- # pedestal (3)
- # polylith (15)
- # reagent (5)
- # releases (3)
- # remote-jobs (1)
- # scittle (9)
- # sql (27)
- # tools-build (9)
- # vim (7)
I’m trying to run a Scittle nREPL session with a bit of an unusual configuration. I have the server and my editor on one machine. However, the browser is running on another device (e.g. a phone). My editor is Neovim and I am using the Conjure plugin.
When all the pieces are running locally, everything works fine. However, when the browser is on a different machine, there are problems. I think the first problem is that Scittle’s nREPL code is hard-coded to use "localhost"
in the Websocket connection. If I instead input ws_nrepl = new WebSocket("ws://<address_of_editor>:1340/_nrepl");
directly into the JavaScript console on my browser, I can see in the network tab of Safari’s development tools that a WebSocket connection seems to be open. Moreover, if I evaluate code in my editor, nREPL messages are showing up as being received. However, it doesn’t appear as if my browser is sending anything back and Conjure never displays the response.
Any ideas what could be the issue? Safari is not reporting any errors in the JavaScript console. Is the ws_nrepl
value I’m creating in the console manually perhaps not what Scittle is trying to use?
Oh, interesting. I started a Scittle session on the browser machine and I can see the nREPL messages with the results are being sent to that machine. I guess it must be that Scittle’s nREPL server is sending the results to localhost (i.e. my browser machine) rather than to the remote (i.e. my editor machine).
Cool. I can make it work by changing the line in src/scittle/nrepl.cljs
(https://github.com/babashka/scittle/blob/151ea479f3723ad68781b3d134e81bd1661d3f99/src/scittle/nrepl.cljs#L39) to use window.location.hostname
. Will submit a PR.
Ah, just found https://github.com/babashka/scittle/blob/main/doc/dev.md. I guess I’ll make an issue first.