I'm able to send ajax requests to a drawbridge repl.
But before I start on the websockets, I was curious whether I could start a cljs repl on top of the drawbridge repl. So, I created a compojure route with a drawbridge repl wrapped with piggieback:
(ANY "/cljs" request ((cemerick.drawbridge/ring-handler
:handler (nrepl/default-handler
#'pback/wrap-cljs-repl)) request))
When I try and run `(cemerick.piggieback/cljs-repl (cljs.repl.rhino/repl-env))`, I get:
java.lang.IllegalStateException: Can't change/establish root binding of: *cljs-repl-env* with set
This is the first time I've had to really dig in and understand how dynamic vars work.
I think the reason this is happening is that in "normal", non-drawbridge repls, the client is running in a different thread than the repl server, and so it's possible to use `set!` to rebind the *cljs-repl-env* to a binding specific to the repl client thread.
But in the case of a drawbridge repl, the nrepl server and client are in the same thread, and so it's not possible to use set! to change the root binding?
Am I on the right track?
If so, seems that I might need to write a slightly different version of `cemerick.piggieback/cljs-repl` that doesn't use set! on any of the dynamic vars so I can use `binding` to control their values instead?