Over the course of this tutorial, we will build a simple chat application step by step. In doing so, we will use core.async in both Clojure and ClojureScript. The steps we will be taking will be:
The source code for this workshop is available from GitHub at https://github.com/sattvik/async-workshop:
$ git clone https://github.com/sattvik/async-workshop
The code is packaged as a Leiningen project. This project includes the source code for this web site,
including the reference, tutorial instructions, and the chat demo itself. You should be able to run the
web site itself using
lein run, which will start listening at
The repository is structured as follows:
src/cljis the root for all of the Clojure code used in the application.
src/chat-demois the root for all of the ClojureScript code used in the application.
devel/cljcontains code primarily for use during development. This includes browser REPL support via Austin, namespace reloading, etc.
The code itself is structured into the following namespaces:
async-workshop.chat-demonamespace. The client (ClojureScript) code will be under
async-workshop.chat-demo.client, and the server (Clojure) code will be under
async-workshop.serveris the main namespace for most of the web app not related to the chat demo/tutorial. You will not need to worry about this code.
To get started with the tutorial, just run
lein repl. This will accomplish a number of handy
tasks for you:
@user/repl-env. For example, you can convert your Leiningen REPL to a ClojureScript browser REPL by invoking
(cemerick.austin.repls/cljs-repl @user/repl-env). Note that browser REPL will hang until you log into the chat demo.
lein cljsbuild auto chat-demoin a separate terminal window as you work on the ClojureScript portions of the tutorial. If you do so, you can just reload the chat demo page and not worry about running a browser REPL.
Ready to get started?