Permalink
Browse files

Update javascript/3.3.1/README.md

Better examples
  • Loading branch information...
1 parent 750219b commit a287a6895a2d9263964feb6fa83e05ef75c090bd @geremyCohen geremyCohen committed Nov 12, 2012
Showing with 31 additions and 5 deletions.
  1. +31 −5 javascript/3.3.1/README.md
View
@@ -45,7 +45,7 @@ business collaborative solutions, and more.
## ADVANCED STYLE
```html
<div id=pubnub pub-key=demo sub-key=demo></div>
-<script src=http://cdn.pubnub.com/pubnub-3.3.1.min.js ></script>
+<script src=http://pubnub.s3.amazonaws.com/pubnub-3.3.1.min.js ></script>
<script>(function(){
// LISTEN FOR MESSAGES
PUBNUB.subscribe({
@@ -69,9 +69,36 @@ business collaborative solutions, and more.
},
reconnect : function() { // CONNECTION RESTORED.
alert("And we're Back!")
+ },
+ presence : function(message) { // Presence() example (see console for logged output.)
+ console.log(message, true);
}
})
-})();</script>
+})();
+
+</script>
+
+<span onclick="hereNow()">Click Me for Here Now!</span> // here_now() example (see console for logged output.)
+ <br/>
+<span onclick="history()">Click Me for History!</span> // detailedHistory() example (see console for logged output.)
+
+<script type="text/javascript">
+
+ function hereNow() {
+ PUBNUB.here_now({channel:'hello_world', callback:function (message) {
+ console.log(message);
+ }});
+ }
+
+ function history() {
+ PUBNUB.detailedHistory({count:10, channel:'hello_world', callback:function (message) {
+ console.log(message);
+ }});
+}
+
+
+</script>
+
```
## SSL MODE
@@ -81,7 +108,7 @@ business collaborative solutions, and more.
<script src=https://pubnub.a.ssl.fastly.net/pubnub-3.3.1.min.js></script>
<script>(function(){
- var pubnub = PUBNUB({
+ var pubnub = PUBNUB.init({
publish_key : 'demo',
subscribe_key : 'demo',
origin : 'pubsub.pubnub.com',
@@ -123,5 +150,4 @@ To do this, simply follow this `init` example:
pubnub.publish({ channel : "hello_world", message : "Hi." })
})();</script>
-```
-
+```

0 comments on commit a287a68

Please sign in to comment.