forked from pubnub/javascript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpublish.js
More file actions
32 lines (24 loc) · 813 Bytes
/
Copy pathpublish.js
File metadata and controls
32 lines (24 loc) · 813 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
/* ---------------------------------------------------------------------------
Init PubNub and Get your PubNub API Keys:
http://www.pubnub.com/account#api-keys
--------------------------------------------------------------------------- */
var pubnub = require("./../pubnub.js").init({
publish_key : "demo",
subscribe_key : "demo"
});
/* ---------------------------------------------------------------------------
Listen for Messages
--------------------------------------------------------------------------- */
function publish(channel, msg) {
pubnub.publish({
channel : channel,
message : msg,
callback : log,
error : retry
});
}
function log(e) { console.log(e) }
function retry() { console.log('retry?') }
for (var i = 0; i < 1; i++) {
publish('dsm-test',i);
}