Reputation: 2753
I've been using Clojure for 4+ years. I recently setup Ring + Compojure, and have a good understanding of how they work. I also have a deep understanding of SVG.
Now, I'm aware of things like ClojureScriptOne, the Google Closure Library, and various online demos setting up Clojure + JQuery + WebSocket.
Can anyone provide a minimal demo for setting up:
* WebSocket in ClojureScript with the google Closure Library?
* Perferably with something involving a basic 2 person chat.
Now, I've looked into the Google Closure book. Unfortunately, when the book was released, it focused mainly on pull mechanisms (AJAX), and its only suggestion for push based mechanism was a long-living ajax session (via things like Comet). Apparently WebSockets were not mature or something at the time.
Thanks!
Upvotes: 3
Views: 1536
Reputation: 4643
There's such an example for Aleph
The only thing you need to do wrt Closure's WebSocket object, is change the constructor for the wrapped socket to whatever Firefox's websocket is for Firefox (can't remember what it is, but it's not WebSocket), or at least that's what you used to have to do, but it works with Chrome anyway. Websockets work with Chrome, Firefox, Opera but not IE but you can use a lib that fixes things to use Flash if IE is that important
Upvotes: 3