Fork me on GitHub
#cider
<
2017-07-18
>
qqq03:07:30

actually, I just got "in emacs, run a command, have output [hiccup] displayed to browser in websocket" working

qqq03:07:35

quite happy with it

benedek06:07:52

any code you can share?

qqq08:07:42

it would be rather rude of me to not; it's spread over a few files, let me see how I can best share it

qqq08:07:00

I can't copy/paste since it ties into an 'object system' our code has, but the server side looks like:

(def *ws-clients (atom #{})) 

(defn blast! [data]
  #?(:clj (doseq [c @*ws-clients]
            (when (not (org.httpkit.server/send! c (str data)))
              (reset! *ws-clients disj c)))
   ))

qqq08:07:23

and for the client side, we have a

[:div
  [:h1 "here is your result"]
  @some-r-atom]

qqq08:07:29

and all what the ws does is updates the some-r-atom

qqq08:07:48

then inside a emacs + clojure repl, to display something, you do (blast! [:h1 "hello world"]) C-x C-e

qqq08:07:14

and it sends the hiccup through the websocket to the client side, which rendcers it

qqq09:07:58

what convniced me it's working for real is when I got

qqq09:07:07

(blast!
[:div
  [:h1 "Hello World"]
  [:img {:src ""}]
  [:h2 "More info 555"]]
)
to work

qqq09:07:16

after that, it was clear it could display arbitrary hiccup

michaellindon15:07:06

I'm using Clojure with Java interop. The following line excutes as expeccted (.get x gurobi.GRB$DoubleAttr/X) but cider doesn't autocomplete anything. I wanted typing gurobi.GRB$Dou... to autocomplete to gurobi.GRB$DoubleAttr

jumar20:07:35

You probably need to add an import for that class first.

rickmoynihan16:07:45

not sure why but cider master seems to keep dying trying to parse spec errors when there’s large gen’d data. Oddly the spec errors are thrown on another thread (web server)… perhaps they’re being parsed from stdout?!

rickmoynihan16:07:51

whatever it is it’s a little annoying as it locks emacs up, I’m guessing trying to parse/font-lock the data… Is this a known issue, and if its intended is there a way to disable this behaviour?