user1311390
user1311390

Reputation:

Clojure: Minimal ClojureScript Two Person Chat

EDIT 01

Sounds like web sockets is what I want.

Technical Background:

I am familiar Clojure + ring + composure.

I am starting to learn ClojureScript. (Have lein-cljsbuild setup; have also spent time installing ClojureScript "manually" just to see how it works.) Have the basic (alert (greeting "ClojureScript")) demo working.

What I want to create:

I want to create a basic two person Notepad (i.e. Instant Messenger, or two-person IRC channel). I want there to be a Clojure Server. When a client connects it shows it a text bok; the user types in some words, the clojure updates to the other user.

Question

I need some help getting started on this. Google Closure is a big library, I would like to understand things like:

(1) how do I setup a basic connection to get my cljs code and my clj code to send each other data

(2) once my cljs code received new data, how do I get it do update the DOM?

I think these are the two main things -- and if I had this, it would provide a framework for understanding the rest of clojurescript.

Thanks!

Upvotes: 4

Views: 1645

Answers (2)

Aaron Iba
Aaron Iba

Reputation: 625

I wrote an example app that does this using clojurescript, ring, and websockets via a Webbit server:

https://github.com/aiba/clojurescript-chat-example

Hope this helps!

Upvotes: 5

user1311390
user1311390

Reputation:

You (I) probably want WebSockets.

More to be updated (if I produce actual working code.)

Upvotes: 1

Related Questions