Skip to content

Commit 502c43a

Browse files
author
gcohen
committed
Adding a new file which will demonstrate migration from 3.x to 4.x
1 parent 7392d31 commit 502c43a

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

node.js/examples/migration.js

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/* ---------------------------------------------------------------------------
2+
3+
Init PubNub and Get your PubNub API Keys:
4+
http://www.pubnub.com/account#api-keys
5+
6+
--------------------------------------------------------------------------- */
7+
8+
function logResults(r){
9+
console.log("RESULT from " + r.operation + " call:");
10+
console.log(JSON.stringify(r,null,2));
11+
}
12+
13+
function logStatus(r){
14+
console.log("STATUS from " + r.operation + " call:");
15+
console.log(JSON.stringify(r,null,2));
16+
}
17+
18+
var pubnub = require("./../pubnub.js").init({
19+
publish_key : "demo-36",
20+
subscribe_key : "demo-36",
21+
secret_key : "demo-36",
22+
ssl : true,
23+
uuid : "v4_migration",
24+
result : logResults,
25+
status : logStatus
26+
});
27+
28+
var channel = "a";
29+
var message = "Hello World !!!"
30+
31+
pubnub.subscribe({
32+
channel: channel}
33+
);
34+
35+
pubnub.history({
36+
channel : channel
37+
});
38+
39+
pubnub.publish({
40+
channel : channel,
41+
message : message
42+
});
43+
44+
pubnub.grant({
45+
channel: channel,
46+
read : true,
47+
write : true
48+
});
49+
50+
pubnub.audit({
51+
channel: channel
52+
});

0 commit comments

Comments
 (0)