forked from pubnub/javascript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsimplecg.html
More file actions
29 lines (23 loc) · 887 Bytes
/
simplecg.html
File metadata and controls
29 lines (23 loc) · 887 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<div id=pubnub></div>
<script src="../pubnub.js"></script>
<script>(function(){
// INIT PubNub
console.log(PUBNUB);
var pubnub = PUBNUB.init({
//leave_on_unload : true, // Perform a Leave Explicitly on Page Unload Event
publish_key : 'demo',
subscribe_key : 'demo'
});
pubnub.channel_group_add_channel({"channel_group":"xxx", "channel":"a", "callback":function(r){ console.log('ERROR : ' + JSON.stringify(r));}});
function cb(m,e,c,d,f){
console.log(JSON.stringify(m));
}
pubnub.subscribe({
callback : cb,
error : function(r){ console.log('ERROR : ' + JSON.stringify(r));},
channel_group : "xxx",
connect : function(r) {console.log("CONNECT");},
disconnect : function(r) {console.log("DISCONNECT");},
reconnect : function(r) {console.log("RECONNECT");}
})
})();</script>