Created
December 10, 2012 03:39
-
-
Save lukelex/4248252 to your computer and use it in GitHub Desktop.
Private Pub client subscription callback
This file contains hidden or 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
| // on privatepub this data is sent by server to client | |
| var opts = { | |
| server: "foo", | |
| channel: "/hello/world", | |
| ... | |
| } | |
| // and you can add a subscription callback | |
| // it will take a Faye subscription object. (see http://faye.jcoglan.com/browser/subscribing.html) | |
| opts.subscription = function(subscription) { | |
| subscription.callback(function() { | |
| // subscription was successful here. | |
| // send an initial message on that channel. | |
| PrivatePub.faye(function(faye){ | |
| faye.send("/hello/world", {text: 'Hey I just connected!'}); | |
| }); | |
| }); | |
| } | |
| PrivatePub.sign(options) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment