Fork me on GitHub

Hey, I'm trying to move from React to Reagent using shadow-cljs but for some reason I don't understand, I keep getting this message *shadow-cljs - Stale Client! You are not using the latest compilation output!*


When I add break points on any piece of code it seems like it gets to it but does not really execute it. not even (js/alert "lala")


If you don't get an answer here, it might be worth asking at #shadow-cljs


yeah I actually copied the question there after I found out theres a channel dedicated to shadow-cljs


Thank you though


Does anyone have experience writing chrome extensions in Clojurescript? What do you use - chromex?


Hey! What is currently well-maintained way of doing WebSockest in Clojure? I am looking for effortless way of talking with Clojure data structures back and forth.


I was looking at Sente, but it feels like abstraction on abstraction on abstraction.. And using it with component on backend it pretty much guesswork.


Why does it feel that way? And what makes it a guesswork?


I haven't had the need for Sente myself, by I would urge you to take a second look at it. Zach Tellman is a fantastic asset to this community. He maintains lots of high-performance Clojure/Java libraries, has many interesting talks, and wrote the awesome book Elements of Clojure that really underscores just how much hammock time is behind his open source stuff.


Basically, he makes good stuff and the abstractions are probably there for a very good reason.


I don’t believe sente is a Zach library


Yep, it's by Peter Taoussanis. Still a great software engineer though, with many OSS projects.


Woops, my bad, but most of what I wrote luckily still applies 😅


I guess I thought of Zach because he is a master of abstractions (manifold) and made Aleph which also has a websocket component.


Well, honestly I am just having difficulties with getting it to work and due to it complexity I’ve got issues finding the cause.



Sun May 10 22:27:20 CEST 2020 [worker-1] ERROR - GET /chsk
java.lang.IllegalStateException: close handler exist:[email protected]46087ec
	at org.httpkit.server.AsyncChannel.setCloseHandler(
	at org.httpkit.server$eval20613$fn__20626.invoke(server.clj:151)
	at org.httpkit.server$eval20514$fn__20584$G__20505__20591.invoke(server.clj:96)
	at taoensso.sente.server_adapters.http_kit.HttpKitServerChanAdapter.ring_req__GT_server_ch_resp(http_kit.clj:25)
	at taoensso.sente$make_channel_socket_server_BANG_$fn__26730.invoke(sente.cljc:638)


With all those layers one on top of another it’s super difficult for me.


I don’t even know really where to start.


I have used pure Jetty websockets (via Pedestal) and haslett/gniazdo for CLJS client. You need to do your own ping/pong to keep the connection alive. And your own auth.


I too felt Sente is overly complicated.


@UB0EMUD34 Impossible to say anything definitive without the code that calls ajax-get-or-ws-handshake-fn. Seems like you call hk/on-close twice on the same object.


@U2FRKM4TW there isn’t really too much code…

(GET  "/chsk" req (ring-ajax-get-or-ws-handshake req))


And component:

:sente (new-channel-socket-server nil
                                     {:csrf-token-fn nil
                                      :allowed-origins #{""}


And in cljs:

(defonce sente-socket
  (sente/make-channel-socket! "/chsk" nil
                              {:type :auto
                               :port 8080


I am just trying to get it working somehow 🙂


Yeah, it seems like you're hitting that issue. I don't know how to fix it by doing anything short of reproducing and debugging it. If you can create a minimal reproducible example (definitely without the component library) and post it in the issue, it definitely could be helpful to those that will try to fix it. I doubt it will be me though. :) I use Sente with Aleph, so far it has been perfect.


With Aleph it seemed like I will be adding another variable into the stack.


How is that different from http-kit in that regard? I use Aleph instead of http-kit.


Well, I already have http-kit for statics 🙂


And I don’t like working around things that way. You know, at some point I will indeed need http-kit and then what..


Either way, I will try to invest more time into that.

👍 4

start with the working sente clone


anyone tried the new functional-compiler of reagent? how would I know that Reagent actually creating function components and not Class components? I mean how can I see the React code that comes out ?


Hi 🙂 You can always look into the JS generated by ClojureScript (either in the browser or in the output dir generated by CLJS). You could log your components and see what they output. In general though, one way to know if a component is a Class or Function component is if the component has a isReactComponent flag. see and for more information about how a class component is transformed in Reagent