-
Notifications
You must be signed in to change notification settings - Fork 285
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
geremy cohen
committed
Nov 2, 2012
1 parent
55f784e
commit cbff508
Showing
1 changed file
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> | ||
|
||
<script src=../pubnub-3.3-common.js></script> | ||
<script src=../pubnub-3.3.js></script> | ||
|
||
<script> | ||
|
||
var setup = {"origin":"multiplexing.pubnub.com", "subscribe_key":"demo", "publish_key":"demo"}; | ||
var p = PUBNUB(setup); | ||
|
||
// LISTEN | ||
p.subscribe({ | ||
channel:"mx_a,mx_b,mx_c", | ||
callback:function (msg) { | ||
console.log(msg) | ||
}, | ||
connect:publish_to_mx_a | ||
}) | ||
|
||
//alert("Watch console.log for receipt of three publishes on a single channel!"); | ||
|
||
function publish_to_mx_a() { | ||
// Publish to channel a | ||
p.publish({ | ||
channel:"mx_a", | ||
message:"Vitamin A (or Vitamin A Retinol, retinal, and four!", | ||
callback:publish_to_mx_b | ||
}) | ||
} | ||
|
||
|
||
// Publish to channel b | ||
|
||
function publish_to_mx_b() { | ||
p.publish({ | ||
channel:"mx_b", | ||
message:"Vitamin B vitamins are a group of water-soluble!", | ||
callback:publish_to_mx_c | ||
}); | ||
} | ||
|
||
function publish_to_mx_c() { | ||
// Publish to channel c | ||
p.publish({ | ||
channel:"mx_c", | ||
message:"Vitamin C or L-ascorbic acid, or simply ascorbate!" | ||
}) | ||
} | ||
|
||
</script> |