This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-01-15
Channels
- # aleph (1)
- # announcements (7)
- # beginners (6)
- # calva (24)
- # cider (18)
- # clj-otel (1)
- # clojars (8)
- # clojure (22)
- # clojure-dev (11)
- # clojure-europe (52)
- # clojure-finland (12)
- # clojure-nl (1)
- # clojure-norway (28)
- # clojure-uk (7)
- # clojured (1)
- # cursive (6)
- # datomic (1)
- # events (1)
- # humbleui (41)
- # hyperfiddle (75)
- # lsp (46)
- # malli (34)
- # matrix (1)
- # off-topic (16)
- # releases (1)
- # shadow-cljs (12)
- # squint (11)
- # timbre (1)
- # tools-deps (24)
Hi there, I currently have my dev setup so that my server clojure code get’s called by the :dev-http
:handler
configuration parameter
This has been a great setup so far that lets me have a single repl between server/client, but now I have to integrate server-sent events. I’m not exactly sure how everything is wired up in shadow-cljs, but my understanding is that what I want to do for my real server code is to call run-jetty
with the :async true
flag. Then my ring handlers would look like (defn handler [request response raise] …)
Is there a way to set this up so that I can have a single repl connection for the shadow-cljs browser window and my clj server code?
don't tell :dev-http about your handler at all, and don't tell your CLJ server about shadow-cljs at all
I sort of outlined my development workflow here https://github.com/thheller/shadow-css?tab=readme-ov-file#development-builds
basically in the start
function you'd start your http server and the shadow-cljs server+builds
(note that it is never necessary to stop
the shadow-cljs server, but might be useful for some things you start)
After following this blog post: https://blog.agical.se/en/posts/shadow-cljs-clojure-cljurescript-calva-nrepl-basics/ I ended up with this
(def jetty
(jetty/run-jetty #'app/handler
{:port 8080
:join? false
:async? true}))
(shadow.cljs.devtools.server/start!)
(shadow.cljs.devtools.api/watch :app)
(shadow.cljs.devtools.api/nrepl-select :app)
And I removed the shadow-cljs dev server all together.
Does that seem right?Oh shoot, except now I can’t toggle between clj and cljs using calva
Turns out if I use one of the shadow-cljs jack in options from calva then this works.