Permalink
Browse files

Initial commit of a simple chatroom service.

  • Loading branch information...
0 parents commit a253122911aff862d716557ac4f4ee59f4597aeb @alexkehayias committed Aug 5, 2012
@@ -0,0 +1,12 @@
+(defproject project "0.01"
+ :description "Aleph testing"
+ :dependencies [[org.clojure/clojure "1.3.0"]
+ [aleph "0.3.0-alpha2"]
+ [compojure "1.1.1"]
+ [ring "1.1.0-beta2"]
+ [hiccup "1.0.0-beta1"]
+ [lein-swank "1.4.4"]]
+ :source-path "src/clj"
+ :aot [core.main]
+ :ring {:handler core.main/-main}
+ :main core.main)
@@ -0,0 +1,10 @@
+$ ->
+ window.socket = new WebSocket window.location.href.replace("http://", "ws://")
+ socket.onopen = ->
+ console.log "socket opened"
+ socket.onmessage = (msg) ->
+ $("#messages").append("<p>"+msg.data+"</p>")
+ $("form").on "submit", (e) ->
+ e.preventDefault()
+ socket.send $("#message").val()
+ $("#message").val ""
@@ -0,0 +1,18 @@
+(function() {
+
+ $(function() {
+ window.socket = new WebSocket(window.location.href.replace("http://", "ws://"));
+ socket.onopen = function() {
+ return console.log("socket opened");
+ };
+ socket.onmessage = function(msg) {
+ return $("#messages").append("<p>" + msg.data + "</p>");
+ };
+ return $("form").on("submit", function(e) {
+ e.preventDefault();
+ socket.send($("#message").val());
+ return $("#message").val("");
+ });
+ });
+
+}).call(this);
Oops, something went wrong.

0 comments on commit a253122

Please sign in to comment.