forked from pubnub/javascript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgrant.js
More file actions
29 lines (22 loc) · 740 Bytes
/
grant.js
File metadata and controls
29 lines (22 loc) · 740 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
/* ---------------------------------------------------------------------------
Init PubNub and Get your PubNub API Keys:
http://www.pubnub.com/account#api-keys
--------------------------------------------------------------------------- */
var pubnub = require("./../pubnub.js").init({
publish_key : "pam",
ssl : true,
subscribe_key : "pam",
secret_key : "pam"
});
function log(r) {
console.log(JSON.stringify(r));
}
/* ---------------------------------------------------------------------------
Listen for Messages
--------------------------------------------------------------------------- */
pubnub.grant({
channel : "foo.*",
callback : log,
error : log,
auth_key : "abcd"
});