Skip to content
Browse files

added Simple Chat example.

  • Loading branch information...
1 parent 7333ce5 commit ed11799d5ed6a4f8a0d19c250ac17bca6d30cbcb @stephenlb stephenlb committed Feb 6, 2012
Showing with 23 additions and 0 deletions.
  1. +23 −0 app-showcase/simple-chat/simple-chat.html
View
23 app-showcase/simple-chat/simple-chat.html
@@ -0,0 +1,23 @@
+<input id=input></input>
+<button id=button>SEND</button>
+<div id=output></div>
+<script src=http://cdn.pubnub.com/pubnub-3.1.min.js></script>
+<script>(function(){
+ var input = PUBNUB.$('input')
+ , button = PUBNUB.$('button')
+ , output = PUBNUB.$('output')
+
+ PUBNUB.subscribe({
+ 'channel' : 'simple-chat',
+ 'callback' : function(message) {
+ output.innerHTML = message + '<br>' + output.innerHTML
+ }
+ })
+
+ PUBNUB.bind( 'mousedown,touchstart', button, function() {
+ PUBNUB.publish({
+ 'channel' : 'simple-chat',
+ 'message' : input.value
+ })
+ } )
+})()</script>

0 comments on commit ed11799

Please sign in to comment.
Something went wrong with that request. Please try again.