Skip to content
This repository has been archived by the owner on Dec 12, 2021. It is now read-only.

private_pub.js changes: only load faye.js if Faye object is not present and use module pattern to prevent pollution of global namespace #51

Open
wants to merge 21 commits into
base: master
Choose a base branch
from

Conversation

vollnhals
Copy link

Allow loading of faye-browser.js directly through asset pipeline, so that only one request is made for .js files in production mode. This also allows easy serving of faye-browser.js through nginx or apache instead of thin.

Also change creation of PrivatePub variable to use module pattern. There is no need to export the buildPrivatePub function into the global namespace.

zlu and others added 17 commits February 22, 2012 13:42
Currently PrivatePub does not allow Redis engine to be specified when initializing the Faye server.
Developers can now create a private_pub_redis.yml where desired values can be specified as per:
http://faye.jcoglan.com/ruby/engines.html

This commit does not include checks for required fields or conflicts between using socket or non-socket approach.
@default_options is what we have today for specifying mount point etc.  But this can be changed to configurable as well.
…atePub is undefined and client will get an error on not able to accessing faye.js.
…up. Log a console error if it is not. PrivatePub client now no longer throw uncaught exception and upon seeing console log error, client can choose to handle the situation by performing a null check on PrivatePub.fayeClient.
…n it is up. Log a console error if it is not. PrivatePub client now no longer throw uncaught exception and upon seeing console log error, client can choose to handle the situation by performing a null check on PrivatePub.fayeClient."

We are violating cross-domain security check by making ajax call to Faye server.

This reverts commit ff647fa.
Faye 0.8.0 contains two incompatible changes according to:
http://blog.jcoglan.com/2012/02/27/faye-0-8-the-refactoring/

Notably, his check-in allows users to specify one of the 3 support adapters through private_pub.yml.
The supported adapters are: thin (default), rainbows, and goliath
this allows the inclusion of faye-browser.js into the asset pipeline as an optimization.
@@ -1,4 +1,4 @@
function buildPrivatePub(doc) {
var PrivatePub = (function (doc) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, the buildPrivatePub function should not be exposed.

vollnhals and others added 4 commits August 22, 2012 12:35
this allows specifying a different faye server url for usage on the (rails) server only. Browser clients will still use :server url.
@nfm
Copy link

nfm commented Jan 26, 2013

As this pull request had a bunch of other commits added to it, I've split it up into a couple of separate pull requests (#69 - conditionally load faye.js, and #70 - only subscribe once to a channel).

I'll look into the Redis related commits shortly.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants