forked from pubnub/javascript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsimple.html
More file actions
40 lines (32 loc) · 902 Bytes
/
simple.html
File metadata and controls
40 lines (32 loc) · 902 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
30
31
32
33
34
35
36
37
38
39
40
<div id=pubnub></div>
<script src="../pubnub.js"></script>
<script>
// INIT PubNub
var pubnub = PUBNUB.init({
origin : 'dara25.devbuild.pubnub.com',
publish_key : 'demo',
subscribe_key : 'demo'
});
pubnub.subscribe({
'channel' : "a",
'callback' : function(r) {
console.log(JSON.stringify(r));
},
'presence' : function(r) {
console.log(JSON.stringify(r));
},
'error' : function(r) {
console.log(JSON.stringify(r));
},
'disconnect' : function(r) {
console.log('DISCONNECT ' + JSON.stringify(r));
},
'reconnect' : function(r) {
console.log('RECONNECT ' +JSON.stringify(r));
},
'connect' : function(r) {
console.log('CONNECT ' +JSON.stringify(r));
pubnub.unsubscribe({'channel' : 'a'});
}
})
</script>