forked from pubnub/javascript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsubUnsubTest.html
More file actions
104 lines (85 loc) · 2.34 KB
/
subUnsubTest.html
File metadata and controls
104 lines (85 loc) · 2.34 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<html>
<!--<script src=http://cdn.pubnub.com/pubnub-3.5.48.min.js></script>-->
<script src=../pubnub.js></script>
<script>
// Init
// var pubnub = PUBNUB.init({
// publish_key: 'demo',
// subscribe_key: 'subKey-c-d247d250-9dbd-11e3-8008-02ee2ddab7fe',
// origin: "pubsub.pubnub.com",
// ssl: false
// })
function initLog(ssl, key) {
console.log("SSL: " + ssl + " " + key);
}
function compatOn(ssl,key){
pubnub = PUBNUB.init({
publish_key: 'demo',
subscribe_key: key,
origin: "pubsub.pubnub.com",
ssl: ssl,
//"compatible_3.5" : true,
uuid: "jst1"
});
initLog(ssl, key);
}
function compatOff(ssl, key){
pubnub = PUBNUB.init({
publish_key: 'demo',
subscribe_key: key ,
origin: "pubsub.pubnub.com",
ssl: ssl,
'compatible_3.5' : false
});
initLog(ssl, key);
}
function subToA() {
pubnub.subscribe({
channel: "gecA",
message: function (m) {
console.log(m);
},
connect: connected
});
}
function subToB() {
pubnub.subscribe({
channel: "gecB",
message: function (m) {
console.log(m);
},
connect: connected
});
}
function unsubToa() {
pubnub.unsubscribe({
channel: "gecA"
});
}
function unsubTob() {
pubnub.unsubscribe({
channel: "gecB"
});
}
function connected() {
console.log("connected.");
}
</script>
<style>
div {margin-bottom: 10}
</style>
<hr/>
INIT
<div onclick="compatOn(true,'sub-c-d247d250-9dbd-11e3-8008-02ee2ddab7fe')">Compat On - SSL ON</div>
<div onclick="compatOn(false,'sub-c-d247d250-9dbd-11e3-8008-02ee2ddab7fe')">Compat On - SSL OFF</div>
<hr/>
<div onclick="compatOff(true, 'sub-c-d91ee366-9dbd-11e3-a759-02ee2ddab7fe')">Compat Off - SSL ON</div>
<div onclick="compatOff(false, 'sub-c-d91ee366-9dbd-11e3-a759-02ee2ddab7fe')">Compat Off - SSL OFF</div>
<hr/>
Test Steps
<div onclick="subToA()">Sub To A</div>
<div onclick="subToB()">Sub To B</div>
<div onclick="unsubToa()">UnSub To A</div>
<hr>
<div onclick="unsubTob()">UnSub To B</div>
</html>