Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

mx example

  • Loading branch information...
commit cbff508fcfc03aadecacae6a352faddddd055635 1 parent 55f784e
geremy cohen authored
Showing with 50 additions and 0 deletions.
  1. +50 −0 javascript-modern/3.3/tests/mx_example.html
View
50 javascript-modern/3.3/tests/mx_example.html
@@ -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>
Please sign in to comment.
Something went wrong with that request. Please try again.