title: Starting the ClojureScript browser REPL
body: <p>I'm trying to start a ClojureScript REPL in a browser. Ideally I'd like not to use Austin yet: I first want to get the simplest REPL possible working.</p>
  
  <p>I tried following various tutorials and so far I didn't manage to make it work. Basically I don't understand what people mean when they say: "Start the ClojureScript browser REPL".</p>
  
  <p>So far I did:</p>
  
  <pre><code>lein new mies hellow
  </code></pre>
  
  <p>And:</p>
  
  <pre><code>lein cljsbuild auto hellow
  </code></pre>
  
  <p>And here's my core.js file:</p>
  
  <pre><code>(ns hellow.core
    (:require [clojure.browser.repl :as repl]))
  
  (enable-console-print!)
  
  (println "Hello world!")    
  (. js/console (log "Hello again"))    
  (repl/connect "http://localhost:9000/repl")    
  (. js/console (log "Ah, this prints too"))
  </code></pre>
  
  <p>When I open my <em>index.html</em> (which calls core.js), I can see in Chrome's developer tools's JavaScript console that everything is correctly logged.</p>
  
  <p>However the <code>(repl/connect ...)</code> obviously fails. Here's what Chrome's developer tools shows;</p>
  
  <pre><code>Failed to load resource http://localhost:9000/repl?xpc=%7B%22cn%22%...
  </code></pre>
  
  <p>In nearly every forum post / blog entry / tutorial about ClojureScript I read about that subject, I stumble upon a line saying: <em>"Start the browser REPL"</em> or something similar.</p>
  
  <p>How do I start the browser REPL?  Is this something that must be done <em>before</em> loading <em>index.html</em> from the browser?</p>
  
  <p>Can I start this browser REPL from Emacs?</p>
  
  <p>How can I test that the browser REPL is working without loading <em>index.html / core.js</em>?</p>
  
  <p>How can I then verify, after <em>index.html / core.js</em> is loaded in the browser, that the <em>(repl/connect ...)</em> inside <em>core.js</em> did work and is actually connected to the REPL?</p>