diff --git a/client/js/cannon.coffee b/client/js/cannon.coffee index e4400a5..12f3c5e 100644 --- a/client/js/cannon.coffee +++ b/client/js/cannon.coffee @@ -1 +1,9 @@ --> +channel = postal.channel { channel: 'chat', topic:'message' } + +subscription = channel.subscribe (data, envelope) -> + console.log data + $('#display').append data + +$('#send').click -> + console.log 'click' + channel.publish {test: 'Hello!'} diff --git a/public/index.html b/public/index.html index 86d77c3..d1568da 100644 --- a/public/index.html +++ b/public/index.html @@ -1,3 +1,19 @@ -

Hello World

- - + + + + + + + + + + + +

Hello World

+
+ + diff --git a/public/js/cannon.js b/public/js/cannon.js index 16a9bca..13a1a8a 100644 --- a/public/js/cannon.js +++ b/public/js/cannon.js @@ -1,5 +1,22 @@ +// Generated by CoffeeScript 1.3.3 (function() { + var channel, subscription; - (function() {}); + channel = postal.channel({ + channel: 'chat', + topic: 'message' + }); + + subscription = channel.subscribe(function(data, envelope) { + console.log(data); + return $('#display').append(data); + }); + + $('#send').click(function() { + console.log('click'); + return channel.publish({ + test: 'Hello!' + }); + }); }).call(this); diff --git a/server/start.coffee b/server/start.coffee index 0bdc297..919957a 100644 --- a/server/start.coffee +++ b/server/start.coffee @@ -1,8 +1,8 @@ path = require 'path' connect = require 'connect' -public = path.join __dirname, '../public' +pub = path.join __dirname, '../public' app = connect() app.listen(4000) -app.use(connect.static public) +app.use(connect.static pub)