1

I'm a ClojureScript newbie using emacs, cider, cljsbuild, and austin with slimerjs on a Windows machine. I've noticed that when I start up the clojurescript repl, that the message

Browser-REPL ready @ http://localhost:xxxx/yyyy/repl/start

appears, and if I point a browser (e.g. Chrome) there, then the side effects of the functions like appendChild or js/alert can be seen. Two Firefox windows also open up, with one that says "SlimerJS." Closing these Firefox windows does not seem to have any effect.

Can someone please explain to me what's going on behind the scenes with the ClojureScript REPL, SlimerJS, and the Browser-REPL that my other browser (Chrome) is connected to?

Anonymous
  • 739
  • 7
  • 15

1 Answers1

2

Short version of the story:

  1. When the page loads, script is being connected using long polling to your ClojureScript REPL backend (for some REPLs web sockets are used instead).
  2. As soon as you do action in REPL, code is translated to JavaScript and sent to browser (via connection from step #1).
  3. Code from step #2 is executed in browser and result is sent back to REPL with additional info - status, type etc.

You can observe all this behaviour while monitoring traffic on Network tab in Chrome Dev Tools (or similar tools for different browsers).

Not sure about SlimerJS, but PhantomJS (they are pretty similar from what I see) in this case would play role of browser from picture above. It hosts and runs translated JavaScript code. In principle, the same is true for server-side ClojureScript code hosted on Node JS.

Jarlax
  • 1,586
  • 10
  • 20