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
from

Projects

None yet

4 participants

@vollnhals

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 some commits Feb 22, 2012
@zlu zlu Added basic support for using Redis engine.
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.
bc81f1e
@zlu zlu Added configuration instruction for Redis engine 045975d
@zlu zlu fixed mount point fe71d80
@zlu zlu Refactor - Redis options are now passed into PrivatePub.faye_app.
@default_options is what we have today for specifying mount point etc.  But this can be changed to configurable as well.
1f753ba
@zlu zlu Added some debugging 38726f8
@zlu zlu Changing how redis config is loaded 33969eb
@zlu zlu Setting default rails_env to be development 00ecd3f
@zlu zlu Increased timeout to 60 298c3ed
@zlu zlu Fixed faye version to be 0.7.1 because thin was removed in a later ve…
…rsion
1f3728f
@zlu zlu Only sign when PrivatePub is avaiable. When thin server is down, Priv…
…atePub is undefined and client will get an error on not able to accessing faye.js.
b17035c
Diana Chow + Zhao Lu Added logic to check in Faye server is up. Only subscribe when 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.
ff647fa
Diana Chow + Zhao Lu Revert "Added logic to check in Faye server is up. Only subscribe whe…
…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.
2a753a6
Diana Chow + Zhao Lu Added support to Faye 0.8.0.
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
265c3bf
Diana Chow + Zhao Lu Actually merge redis options b0d96ce
@vollnhals vollnhals Use module pattern. Do not export buildPrivatePub function unnecessar…
…ily to global namespace.
a4dbd30
@vollnhals vollnhals only load faye.js if Faye object is not present
this allows the inclusion of faye-browser.js into the asset pipeline as an optimization.
2790cc8
@vollnhals vollnhals only subscribe once to a channel 21f352d
@vic vic commented on the diff Aug 22, 2012
app/assets/javascripts/private_pub.js
@@ -1,4 +1,4 @@
-function buildPrivatePub(doc) {
+var PrivatePub = (function (doc) {
@vic
vic Aug 22, 2012 Contributor

+1, the buildPrivatePub function should not be exposed.

Lion Vollnhals and others added some commits Aug 22, 2012
Lion Vollnhals Merge branch 'master' of https://github.com/ryanb/private_pub 105016d
Lion Vollnhals merge zlu master 8e6da99
Lion Vollnhals do not load private_pub_redis.yml in rails 08b1345
@vollnhals vollnhals Allow configuration of server side faye server url
this allows specifying a different faye server url for usage on the (rails) server only. Browser clients will still use :server url.
28931ca
@nfm
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 join this conversation on GitHub. Already have an account? Sign in to comment