Skip to content

Commit 3d1d9a8

Browse files
author
gcohen
committed
added simple cg example
1 parent 88a10ec commit 3d1d9a8

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

web/examples/simplecg.html

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
2+
<div id=pubnub></div>
3+
<script src="../pubnub.js"></script>
4+
<script>(function(){
5+
// INIT PubNub
6+
console.log(PUBNUB);
7+
var pubnub = PUBNUB.init({
8+
//leave_on_unload : true, // Perform a Leave Explicitly on Page Unload Event
9+
publish_key : 'demo',
10+
subscribe_key : 'demo'
11+
});
12+
13+
pubnub.channel_group_add_channel({"channel_group":"xxx", "channel":"a", "callback":function(r){ console.log('ERROR : ' + JSON.stringify(r));}});
14+
15+
16+
function cb(m,e,c,d,f){
17+
console.log(JSON.stringify(m));
18+
}
19+
pubnub.subscribe({
20+
callback : cb,
21+
error : function(r){ console.log('ERROR : ' + JSON.stringify(r));},
22+
channel_group : "xxx",
23+
connect : function(r) {console.log("CONNECT");},
24+
disconnect : function(r) {console.log("DISCONNECT");},
25+
reconnect : function(r) {console.log("RECONNECT");}
26+
})
27+
28+
29+
})();</script>

0 commit comments

Comments
 (0)