Clojure: Minimal ClojureScript Two Person Chat

EDIT 01

Web sockets seem to be what I want.

Technical information:

I am familiar with Clojure + ring + calm.

I am starting to learn ClojureScript. (You have a lein-cljsbuild installation, and also took the time to install ClojureScript “manually” to see how it works.) You have a basic demo (“ClojureScript” greeting).

What I want to create:

I want to create a basic notepad of two people (i.e., Instant messenger or IRC channel with two people). I want a Clojure server there. When a client connects, it shows a text side; user enters a few words, Clojure updates another user.

Question

I need help with this. Google Closure is a large library, I would like to understand things like:

(1) how to set up a basic connection to get cljs code and clj code to send data to each other.

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

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

Thanks!

+4
source share
2 answers

You (I) probably want to use WebSockets.

More to update (if I create the actual working code.)

+1
source

I wrote an example application that does this with clojurescript, ring and websockets through a web server:

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

Hope this helps!

+5
source

Source: https://habr.com/ru/post/1416493/


All Articles