Skip to content

Commit 2ba4ecd

Browse files
author
gcohen
committed
subscribe with HB example.
1 parent 2b82b97 commit 2ba4ecd

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

web/examples/subWithHB.html

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<script src="http://cdn.pubnub.com/pubnub-dev.js"></script>
2+
<script>
3+
4+
// INIT PubNub
5+
6+
var pubnub = PUBNUB.init({
7+
publish_key : 'demo-36',
8+
publish_key : 'demo-36',
9+
secret_key : 'demo-36',
10+
uuid: "subWithHB"
11+
});
12+
13+
14+
pubnub.subscribe({
15+
'channel' : Math.floor((Math.random() * 1000) + 1) + 'a.*',
16+
'callback' : function(r) {
17+
console.log(JSON.stringify(r));
18+
},
19+
'presence' : function(r) {
20+
console.log(JSON.stringify(r));
21+
},
22+
'error' : function(r) {
23+
console.log(JSON.stringify(r));
24+
},
25+
'disconnect' : function(r) {
26+
console.log('DISCONNECT ' + JSON.stringify(r));
27+
},
28+
'reconnect' : function(r) {
29+
console.log('RECONNECT ' +JSON.stringify(r));
30+
},
31+
'connect' : function(r) {
32+
console.log('CONNECT ' +JSON.stringify(r));
33+
},
34+
heartbeat: 10
35+
})
36+
37+
38+
39+
40+
</script>

0 commit comments

Comments
 (0)