faye 0.8.2 → 0.8.3
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of faye might be problematic. Click here for more details.
- data/History.txt +11 -0
- data/README.rdoc +0 -9
- data/lib/faye-browser-min.js +1 -1
- data/lib/faye-browser-min.js.map +2 -2
- data/lib/faye-browser.js +41 -44
- data/lib/faye.rb +1 -1
- data/lib/faye/adapters/rack_adapter.rb +22 -4
- data/lib/faye/engines/proxy.rb +7 -1
- data/lib/faye/protocol/client.rb +5 -8
- data/lib/faye/transport/transport.rb +3 -2
- data/spec/javascript/client_spec.js +23 -14
- data/spec/javascript/transport_spec.js +1 -1
- data/spec/ruby/client_spec.rb +23 -14
- data/spec/ruby/transport_spec.rb +1 -0
- metadata +122 -37
data/History.txt
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
=== 0.8.3 / 2012-07-15
|
2
|
+
|
3
|
+
* Client#subscribe returns an array of Subscriptions if given an array of channels
|
4
|
+
* Allow different endpoints to be specified per-transport
|
5
|
+
* Only use IE's XDomainRequest for same-protocol requests
|
6
|
+
* Replace URL parser with one that treats relative URLs the same as the browser
|
7
|
+
* Improve logging of malformed requests and detect problems earlier
|
8
|
+
* Make sure socket connections are closed when a client session is timed out
|
9
|
+
* Stop WebSocket reconnecting after window.onbeforeunload
|
10
|
+
|
11
|
+
|
1
12
|
=== 0.8.2 / 2012-04-12
|
2
13
|
TestSwarm build: http://swarm.jcoglan.com/job/125/
|
3
14
|
|
data/README.rdoc
CHANGED
@@ -51,18 +51,9 @@ should get you up and running:
|
|
51
51
|
|
52
52
|
== To-do
|
53
53
|
|
54
|
-
Notification API:
|
55
|
-
|
56
|
-
* Notify listeners of network drop-out (may be transport dependent)
|
57
54
|
* Provide reflection API for internal stats on channels, subscriptions, message queues
|
58
55
|
* (Maybe) build a monitoring GUI into the server
|
59
|
-
|
60
|
-
Sugar:
|
61
|
-
|
62
56
|
* Add sugar for authentication extensions for protected subscribe + publish
|
63
|
-
|
64
|
-
Missing protocol features:
|
65
|
-
|
66
57
|
* Provide support for user-defined <tt>/service/*</tt> channels
|
67
58
|
* Let local server-side clients listen to <tt>/meta/*</tt> channels
|
68
59
|
|
data/lib/faye-browser-min.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
var Faye=(typeof Faye==='object')?Faye:{};if(typeof window!=='undefined')window.Faye=Faye;Faye.extend=function(a,b,c){if(!b)return a;for(var d in b){if(!b.hasOwnProperty(d))continue;if(a.hasOwnProperty(d)&&c===false)continue;if(a[d]!==b[d])a[d]=b[d]}return a};Faye.extend(Faye,{VERSION:'0.8.2',BAYEUX_VERSION:'1.0',ID_LENGTH:128,JSONP_CALLBACK:'jsonpcallback',CONNECTION_TYPES:['long-polling','cross-origin-long-polling','callback-polling','websocket','eventsource','in-process'],MANDATORY_CONNECTION_TYPES:['long-polling','callback-polling','in-process'],ENV:(function(){return this})(),random:function(a){a=a||this.ID_LENGTH;if(a>32){var b=Math.ceil(a/32),c='';while(b--)c+=this.random(32);return c}var d=Math.pow(2,a)-1,f=d.toString(36).length,c=Math.floor(Math.random()*d).toString(36);while(c.length<f)c='0'+c;return c},clientIdFromMessages:function(a){var b=[].concat(a)[0];return b&&b.clientId},copyObject:function(a){var b,c,d;if(a instanceof Array){b=[];c=a.length;while(c--)b[c]=Faye.copyObject(a[c]);return b}else if(typeof a==='object'){b=(a===null)?null:{};for(d in a)b[d]=Faye.copyObject(a[d]);return b}else{return a}},commonElement:function(a,b){for(var c=0,d=a.length;c<d;c++){if(this.indexOf(b,a[c])!==-1)return a[c]}return null},indexOf:function(a,b){if(a.indexOf)return a.indexOf(b);for(var c=0,d=a.length;c<d;c++){if(a[c]===b)return c}return-1},map:function(a,b,c){if(a.map)return a.map(b,c);var d=[];if(a instanceof Array){for(var f=0,g=a.length;f<g;f++){d.push(b.call(c||null,a[f],f))}}else{for(var j in a){if(!a.hasOwnProperty(j))continue;d.push(b.call(c||null,j,a[j]))}}return d},filter:function(a,b,c){var d=[];for(var f=0,g=a.length;f<g;f++){if(b.call(c||null,a[f],f))d.push(a[f])}return d},asyncEach:function(a,b,c,d){var f=a.length,g=-1,j=0,i=false;var h=function(){j-=1;g+=1;if(g===f)return c&&c.call(d);b(a[g],m)};var k=function(){if(i)return;i=true;while(j>0)h();i=false};var m=function(){j+=1;k()};m()},toJSON:function(a){if(this.stringify)return this.stringify(a,function(key,value){return(this[key]instanceof Array)?this[key]:value});return JSON.stringify(a)},logger:function(a){if(typeof console!=='undefined')console.log(a)},timestamp:function(){var b=new Date(),c=b.getFullYear(),d=b.getMonth()+1,f=b.getDate(),g=b.getHours(),j=b.getMinutes(),i=b.getSeconds();var h=function(a){return a<10?'0'+a:String(a)};return h(c)+'-'+h(d)+'-'+h(f)+' '+h(g)+':'+h(j)+':'+h(i)}});Faye.Class=function(a,b){if(typeof a!=='function'){b=a;a=Object}var c=function(){if(!this.initialize)return this;return this.initialize.apply(this,arguments)||this};var d=function(){};d.prototype=a.prototype;c.prototype=new d();Faye.extend(c.prototype,b);return c};Faye.Namespace=Faye.Class({initialize:function(){this._d={}},exists:function(a){return this._d.hasOwnProperty(a)},generate:function(){var a=Faye.random();while(this._d.hasOwnProperty(a))a=Faye.random();return this._d[a]=a},release:function(a){delete this._d[a]}});Faye.Error=Faye.Class({initialize:function(a,b,c){this.code=a;this.params=Array.prototype.slice.call(b);this.message=c},toString:function(){return this.code+':'+this.params.join(',')+':'+this.message}});Faye.Error.parse=function(a){a=a||'';if(!Faye.Grammar.ERROR.test(a))return new this(null,[],a);var b=a.split(':'),c=parseInt(b[0]),d=b[1].split(','),a=b[2];return new this(c,d,a)};Faye.Error.versionMismatch=function(){return new this(300,arguments,"Version mismatch").toString()};Faye.Error.conntypeMismatch=function(){return new this(301,arguments,"Connection types not supported").toString()};Faye.Error.extMismatch=function(){return new this(302,arguments,"Extension mismatch").toString()};Faye.Error.badRequest=function(){return new this(400,arguments,"Bad request").toString()};Faye.Error.clientUnknown=function(){return new this(401,arguments,"Unknown client").toString()};Faye.Error.parameterMissing=function(){return new this(402,arguments,"Missing required parameter").toString()};Faye.Error.channelForbidden=function(){return new this(403,arguments,"Forbidden channel").toString()};Faye.Error.channelUnknown=function(){return new this(404,arguments,"Unknown channel").toString()};Faye.Error.channelInvalid=function(){return new this(405,arguments,"Invalid channel").toString()};Faye.Error.extUnknown=function(){return new this(406,arguments,"Unknown extension").toString()};Faye.Error.publishFailed=function(){return new this(407,arguments,"Failed to publish").toString()};Faye.Error.serverError=function(){return new this(500,arguments,"Internal server error").toString()};Faye.Deferrable={callback:function(a,b){if(!a)return;if(this._v==='succeeded')return a.apply(b,this._j);this._k=this._k||[];this._k.push([a,b])},timeout:function(a,b){var c=this;var d=Faye.ENV.setTimeout(function(){c.setDeferredStatus('failed',b)},a*1000);this._w=d},errback:function(a,b){if(!a)return;if(this._v==='failed')return a.apply(b,this._j);this._l=this._l||[];this._l.push([a,b])},setDeferredStatus:function(){if(this._w)Faye.ENV.clearTimeout(this._w);var a=Array.prototype.slice.call(arguments),b=a.shift(),c;this._v=b;this._j=a;if(b==='succeeded')c=this._k;else if(b==='failed')c=this._l;if(!c)return;var d;while(d=c.shift())d[0].apply(d[1],this._j)}};Faye.Publisher={countListeners:function(a){if(!this._3||!this._3[a])return 0;return this._3[a].length},bind:function(a,b,c){this._3=this._3||{};var d=this._3[a]=this._3[a]||[];d.push([b,c])},unbind:function(a,b,c){if(!this._3||!this._3[a])return;if(!b){delete this._3[a];return}var d=this._3[a],f=d.length;while(f--){if(b!==d[f][0])continue;if(c&&d[f][1]!==c)continue;d.splice(f,1)}},trigger:function(){var a=Array.prototype.slice.call(arguments),b=a.shift();if(!this._3||!this._3[b])return;var c=this._3[b].slice(),d;for(var f=0,g=c.length;f<g;f++){d=c[f];d[0].apply(d[1],a)}}};Faye.Timeouts={addTimeout:function(a,b,c,d){this._5=this._5||{};if(this._5.hasOwnProperty(a))return;var f=this;this._5[a]=Faye.ENV.setTimeout(function(){delete f._5[a];c.call(d)},1000*b)},removeTimeout:function(a){this._5=this._5||{};var b=this._5[a];if(!b)return;clearTimeout(b);delete this._5[a]}};Faye.Logging={LOG_LEVELS:{error:3,warn:2,info:1,debug:0},logLevel:'error',log:function(a,b){if(!Faye.logger)return;var c=Faye.Logging.LOG_LEVELS;if(c[Faye.Logging.logLevel]>c[b])return;var a=Array.prototype.slice.apply(a),d=' ['+b.toUpperCase()+'] [Faye',f=this.className,g=a.shift().replace(/\?/g,function(){try{return Faye.toJSON(a.shift())}catch(e){return'[Object]'}});for(var j in Faye){if(f)continue;if(typeof Faye[j]!=='function')continue;if(this instanceof Faye[j])f=j}if(f)d+='.'+f;d+='] ';Faye.logger(Faye.timestamp()+d+g)}};(function(){for(var c in Faye.Logging.LOG_LEVELS)(function(a,b){Faye.Logging[a]=function(){this.log(arguments,a)}})(c,Faye.Logging.LOG_LEVELS[c])})();Faye.Grammar={LOWALPHA:/^[a-z]$/,UPALPHA:/^[A-Z]$/,ALPHA:/^([a-z]|[A-Z])$/,DIGIT:/^[0-9]$/,ALPHANUM:/^(([a-z]|[A-Z])|[0-9])$/,MARK:/^(\-|\_|\!|\~|\(|\)|\$|\@)$/,STRING:/^(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*$/,TOKEN:/^(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)))+$/,INTEGER:/^([0-9])+$/,CHANNEL_SEGMENT:/^(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)))+$/,CHANNEL_SEGMENTS:/^(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)))+(\/(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)))+)*$/,CHANNEL_NAME:/^\/(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)))+(\/(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)))+)*$/,WILD_CARD:/^\*{1,2}$/,CHANNEL_PATTERN:/^(\/(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)))+)*\/\*{1,2}$/,VERSION_ELEMENT:/^(([a-z]|[A-Z])|[0-9])(((([a-z]|[A-Z])|[0-9])|\-|\_))*$/,VERSION:/^([0-9])+(\.(([a-z]|[A-Z])|[0-9])(((([a-z]|[A-Z])|[0-9])|\-|\_))*)*$/,CLIENT_ID:/^((([a-z]|[A-Z])|[0-9]))+$/,ID:/^((([a-z]|[A-Z])|[0-9]))+$/,ERROR_MESSAGE:/^(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*$/,ERROR_ARGS:/^(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*(,(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*)*$/,ERROR_CODE:/^[0-9][0-9][0-9]$/,ERROR:/^([0-9][0-9][0-9]:(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*(,(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*)*:(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*|[0-9][0-9][0-9]::(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*)$/};Faye.Extensible={addExtension:function(a){this._6=this._6||[];this._6.push(a);if(a.added)a.added(this)},removeExtension:function(a){if(!this._6)return;var b=this._6.length;while(b--){if(this._6[b]!==a)continue;this._6.splice(b,1);if(a.removed)a.removed(this)}},pipeThroughExtensions:function(c,d,f,g){this.debug('Passing through ? extensions: ?',c,d);if(!this._6)return f.call(g,d);var j=this._6.slice();var i=function(a){if(!a)return f.call(g,a);var b=j.shift();if(!b)return f.call(g,a);if(b[c])b[c](a,i);else i(a)};i(d)}};Faye.extend(Faye.Extensible,Faye.Logging);Faye.Channel=Faye.Class({initialize:function(a){this.id=this.name=a},push:function(a){this.trigger('message',a)},isUnused:function(){return this.countListeners('message')===0}});Faye.extend(Faye.Channel.prototype,Faye.Publisher);Faye.extend(Faye.Channel,{HANDSHAKE:'/meta/handshake',CONNECT:'/meta/connect',SUBSCRIBE:'/meta/subscribe',UNSUBSCRIBE:'/meta/unsubscribe',DISCONNECT:'/meta/disconnect',META:'meta',SERVICE:'service',expand:function(a){var b=this.parse(a),c=['/**',a];var d=b.slice();d[d.length-1]='*';c.push(this.unparse(d));for(var f=1,g=b.length;f<g;f++){d=b.slice(0,f);d.push('**');c.push(this.unparse(d))}return c},isValid:function(a){return Faye.Grammar.CHANNEL_NAME.test(a)||Faye.Grammar.CHANNEL_PATTERN.test(a)},parse:function(a){if(!this.isValid(a))return null;return a.split('/').slice(1)},unparse:function(a){return'/'+a.join('/')},isMeta:function(a){var b=this.parse(a);return b?(b[0]===this.META):null},isService:function(a){var b=this.parse(a);return b?(b[0]===this.SERVICE):null},isSubscribable:function(a){if(!this.isValid(a))return null;return!this.isMeta(a)&&!this.isService(a)},Set:Faye.Class({initialize:function(){this._2={}},getKeys:function(){var a=[];for(var b in this._2)a.push(b);return a},remove:function(a){delete this._2[a]},hasSubscription:function(a){return this._2.hasOwnProperty(a)},subscribe:function(a,b,c){if(!b)return;var d;for(var f=0,g=a.length;f<g;f++){d=a[f];var j=this._2[d]=this._2[d]||new Faye.Channel(d);j.bind('message',b,c)}},unsubscribe:function(a,b,c){var d=this._2[a];if(!d)return false;d.unbind('message',b,c);if(d.isUnused()){this.remove(a);return true}else{return false}},distributeMessage:function(a){var b=Faye.Channel.expand(a.channel);for(var c=0,d=b.length;c<d;c++){var f=this._2[b[c]];if(f)f.trigger('message',a.data)}}})});Faye.Publication=Faye.Class(Faye.Deferrable);Faye.Subscription=Faye.Class({initialize:function(a,b,c,d){this._7=a;this._2=b;this._m=c;this._n=d;this._x=false},cancel:function(){if(this._x)return;this._7.unsubscribe(this._2,this._m,this._n);this._x=true},unsubscribe:function(){this.cancel()}});Faye.extend(Faye.Subscription.prototype,Faye.Deferrable);Faye.Client=Faye.Class({UNCONNECTED:1,CONNECTING:2,CONNECTED:3,DISCONNECTED:4,HANDSHAKE:'handshake',RETRY:'retry',NONE:'none',CONNECTION_TIMEOUT:60.0,DEFAULT_RETRY:5.0,DEFAULT_ENDPOINT:'/bayeux',INTERVAL:0.0,initialize:function(a,b){this.info('New client created for ?',a);this.endpoint=a||this.DEFAULT_ENDPOINT;this._E=Faye.CookieJar&&new Faye.CookieJar();this._y={};this._o=b||{};this._p=[];this.retry=this._o.retry||this.DEFAULT_RETRY;this._z(Faye.MANDATORY_CONNECTION_TYPES);this._1=this.UNCONNECTED;this._2=new Faye.Channel.Set();this._e=0;this._q={};this._8={reconnect:this.RETRY,interval:1000*(this._o.interval||this.INTERVAL),timeout:1000*(this._o.timeout||this.CONNECTION_TIMEOUT)};if(Faye.Event)Faye.Event.on(Faye.ENV,'beforeunload',function(){if(Faye.indexOf(this._p,'autodisconnect')<0)this.disconnect()},this)},disable:function(a){this._p.push(a)},setHeader:function(a,b){this._y[a]=b},getClientId:function(){return this._0},getState:function(){switch(this._1){case this.UNCONNECTED:return'UNCONNECTED';case this.CONNECTING:return'CONNECTING';case this.CONNECTED:return'CONNECTED';case this.DISCONNECTED:return'DISCONNECTED'}},handshake:function(d,f){if(this._8.reconnect===this.NONE)return;if(this._1!==this.UNCONNECTED)return;this._1=this.CONNECTING;var g=this;this.info('Initiating handshake with ?',this.endpoint);this._9({channel:Faye.Channel.HANDSHAKE,version:Faye.BAYEUX_VERSION,supportedConnectionTypes:[this._a.connectionType]},function(b){if(b.successful){this._1=this.CONNECTED;this._0=b.clientId;var c=Faye.filter(b.supportedConnectionTypes,function(a){return Faye.indexOf(this._p,a)<0},this);this._z(c);this.info('Handshake successful: ?',this._0);this.subscribe(this._2.getKeys(),true);if(d)d.call(f)}else{this.info('Handshake unsuccessful');Faye.ENV.setTimeout(function(){g.handshake(d,f)},this._8.interval);this._1=this.UNCONNECTED}},this)},connect:function(a,b){if(this._8.reconnect===this.NONE)return;if(this._1===this.DISCONNECTED)return;if(this._1===this.UNCONNECTED)return this.handshake(function(){this.connect(a,b)},this);this.callback(a,b);if(this._1!==this.CONNECTED)return;this.info('Calling deferred actions for ?',this._0);this.setDeferredStatus('succeeded');this.setDeferredStatus('deferred');if(this._r)return;this._r=true;this.info('Initiating connection for ?',this._0);this._9({channel:Faye.Channel.CONNECT,clientId:this._0,connectionType:this._a.connectionType},this._A,this)},disconnect:function(){if(this._1!==this.CONNECTED)return;this._1=this.DISCONNECTED;this.info('Disconnecting ?',this._0);this._9({channel:Faye.Channel.DISCONNECT,clientId:this._0},function(a){if(a.successful)this._a.close()},this);this.info('Clearing channel listeners for ?',this._0);this._2=new Faye.Channel.Set()},subscribe:function(c,d,f){if(c instanceof Array){for(var g=0,j=c.length;g<j;g++){this.subscribe(c[g],d,f)}return}var i=new Faye.Subscription(this,c,d,f),h=(d===true),k=this._2.hasSubscription(c);if(k&&!h){this._2.subscribe([c],d,f);i.setDeferredStatus('succeeded');return i}this.connect(function(){this.info('Client ? attempting to subscribe to ?',this._0,c);if(!h)this._2.subscribe([c],d,f);this._9({channel:Faye.Channel.SUBSCRIBE,clientId:this._0,subscription:c},function(a){if(!a.successful){i.setDeferredStatus('failed',Faye.Error.parse(a.error));return this._2.unsubscribe(c,d,f)}var b=[].concat(a.subscription);this.info('Subscription acknowledged for ? to ?',this._0,b);i.setDeferredStatus('succeeded')},this)},this);return i},unsubscribe:function(c,d,f){if(c instanceof Array){for(var g=0,j=c.length;g<j;g++){this.unsubscribe(c[g],d,f)}return}var i=this._2.unsubscribe(c,d,f);if(!i)return;this.connect(function(){this.info('Client ? attempting to unsubscribe from ?',this._0,c);this._9({channel:Faye.Channel.UNSUBSCRIBE,clientId:this._0,subscription:c},function(a){if(!a.successful)return;var b=[].concat(a.subscription);this.info('Unsubscription acknowledged for ? from ?',this._0,b)},this)},this)},publish:function(b,c){var d=new Faye.Publication();this.connect(function(){this.info('Client ? queueing published message to ?: ?',this._0,b,c);this._9({channel:b,data:c,clientId:this._0},function(a){if(a.successful)d.setDeferredStatus('succeeded');else d.setDeferredStatus('failed',Faye.Error.parse(a.error))},this)},this);return d},receiveMessage:function(c){this.pipeThroughExtensions('incoming',c,function(a){if(!a)return;if(a.advice)this._F(a.advice);this._G(a);if(a.successful===undefined)return;var b=this._q[a.id];if(!b)return;delete this._q[a.id];b[0].call(b[1],a)},this)},_z:function(b){Faye.Transport.get(this,b,function(a){this._a=a;this._a.cookies=this._E;this._a.headers=this._y;a.bind('down',function(){if(this._c!==undefined&&!this._c)return;this._c=false;this.trigger('transport:down')},this);a.bind('up',function(){if(this._c!==undefined&&this._c)return;this._c=true;this.trigger('transport:up')},this)},this)},_9:function(b,c,d){b.id=this._H();if(c)this._q[b.id]=[c,d];this.pipeThroughExtensions('outgoing',b,function(a){if(!a)return;this._a.send(a,this._8.timeout/1000)},this)},_H:function(){this._e+=1;if(this._e>=Math.pow(2,32))this._e=0;return this._e.toString(36)},_F:function(a){Faye.extend(this._8,a);if(this._8.reconnect===this.HANDSHAKE&&this._1!==this.DISCONNECTED){this._1=this.UNCONNECTED;this._0=null;this._A()}},_G:function(a){if(!a.channel||a.data===undefined)return;this.info('Client ? calling listeners for ? with ?',this._0,a.channel,a.data);this._2.distributeMessage(a)},_I:function(){if(!this._r)return;this._r=null;this.info('Closed connection for ?',this._0)},_A:function(){this._I();var a=this;Faye.ENV.setTimeout(function(){a.connect()},this._8.interval)}});Faye.extend(Faye.Client.prototype,Faye.Deferrable);Faye.extend(Faye.Client.prototype,Faye.Publisher);Faye.extend(Faye.Client.prototype,Faye.Logging);Faye.extend(Faye.Client.prototype,Faye.Extensible);Faye.Transport=Faye.extend(Faye.Class({MAX_DELAY:0.0,batching:true,initialize:function(a,b){this.debug('Created new ? transport for ?',this.connectionType,b);this._7=a;this._b=b;this._f=[]},close:function(){},send:function(a,b){this.debug('Client ? sending message to ?: ?',this._7._0,this._b,a);if(!this.batching)return this.request([a],b);this._f.push(a);this._J=b;if(a.channel===Faye.Channel.HANDSHAKE)return this.flush();if(a.channel===Faye.Channel.CONNECT)this._s=a;this.addTimeout('publish',this.MAX_DELAY,this.flush,this)},flush:function(){this.removeTimeout('publish');if(this._f.length>1&&this._s)this._s.advice={timeout:0};this.request(this._f,this._J);this._s=null;this._f=[]},receive:function(a){this.debug('Client ? received from ?: ?',this._7._0,this._b,a);for(var b=0,c=a.length;b<c;b++){this._7.receiveMessage(a[b])}},retry:function(a,b){var c=false,d=this._7.retry*1000,f=this;return function(){if(c)return;c=true;Faye.ENV.setTimeout(function(){f.request(a,b)},d)}}}),{get:function(g,j,i,h){var k=g.endpoint;if(j===undefined)j=this.supportedConnectionTypes();Faye.asyncEach(this._t,function(b,c){var d=b[0],f=b[1];if(Faye.indexOf(j,d)<0)return c();f.isUsable(k,function(a){if(a)i.call(h,new f(g,k));else c()})},function(){throw new Error('Could not find a usable connection type for '+k);})},register:function(a,b){this._t.push([a,b]);b.prototype.connectionType=a},_t:[],supportedConnectionTypes:function(){return Faye.map(this._t,function(a){return a[0]})}});Faye.extend(Faye.Transport.prototype,Faye.Logging);Faye.extend(Faye.Transport.prototype,Faye.Publisher);Faye.extend(Faye.Transport.prototype,Faye.Timeouts);Faye.Event={_g:[],on:function(a,b,c,d){var f=function(){c.call(d)};if(a.addEventListener)a.addEventListener(b,f,false);else a.attachEvent('on'+b,f);this._g.push({_h:a,_u:b,_m:c,_n:d,_B:f})},detach:function(a,b,c,d){var f=this._g.length,g;while(f--){g=this._g[f];if((a&&a!==g._h)||(b&&b!==g._u)||(c&&c!==g._m)||(d&&d!==g._n))continue;if(g._h.removeEventListener)g._h.removeEventListener(g._u,g._B,false);else g._h.detachEvent('on'+g._u,g._B);this._g.splice(f,1);g=null}}};Faye.Event.on(Faye.ENV,'unload',Faye.Event.detach,Faye.Event);Faye.URI=Faye.extend(Faye.Class({queryString:function(){var a=[];for(var b in this.params){if(!this.params.hasOwnProperty(b))continue;a.push(encodeURIComponent(b)+'='+encodeURIComponent(this.params[b]))}return a.join('&')},isLocal:function(){var a=Faye.URI.parse(Faye.ENV.location.href);var b=(a.hostname!==this.hostname)||(a.port!==this.port)||(a.protocol!==this.protocol);return!b},toURL:function(){var a=this.queryString();return this.protocol+this.hostname+':'+this.port+this.pathname+(a?'?'+a:'')}}),{parse:function(d,f){if(typeof d!=='string')return d;var g=new this();var j=function(b,c){d=d.replace(c,function(a){if(a)g[b]=a;return''})};j('protocol',/^https?\:\/+/);j('hostname',/^[^\/\:]+/);j('port',/^:[0-9]+/);Faye.extend(g,{protocol:Faye.ENV.location.protocol+'//',hostname:Faye.ENV.location.hostname,port:Faye.ENV.location.port},false);if(!g.port)g.port=(g.protocol==='https://')?'443':'80';g.port=g.port.replace(/\D/g,'');var i=d.split('?'),h=i.shift(),k=i.join('?'),m=k?k.split('&'):[],n=m.length,l={};while(n--){i=m[n].split('=');l[decodeURIComponent(i[0]||'')]=decodeURIComponent(i[1]||'')}if(typeof f==='object')Faye.extend(l,f);g.pathname=h;g.params=l;return g}});if(!this.JSON){JSON={}}(function(){function k(a){return a<10?'0'+a:a}if(typeof Date.prototype.toJSON!=='function'){Date.prototype.toJSON=function(a){return this.getUTCFullYear()+'-'+k(this.getUTCMonth()+1)+'-'+k(this.getUTCDate())+'T'+k(this.getUTCHours())+':'+k(this.getUTCMinutes())+':'+k(this.getUTCSeconds())+'Z'};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(a){return this.valueOf()}}var m=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,n=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,l,p,s={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},o;function r(c){n.lastIndex=0;return n.test(c)?'"'+c.replace(n,function(a){var b=s[a];return typeof b==='string'?b:'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+c+'"'}function q(a,b){var c,d,f,g,j=l,i,h=b[a];if(h&&typeof h==='object'&&typeof h.toJSON==='function'){h=h.toJSON(a)}if(typeof o==='function'){h=o.call(b,a,h)}switch(typeof h){case'string':return r(h);case'number':return isFinite(h)?String(h):'null';case'boolean':case'null':return String(h);case'object':if(!h){return'null'}l+=p;i=[];if(Object.prototype.toString.apply(h)==='[object Array]'){g=h.length;for(c=0;c<g;c+=1){i[c]=q(c,h)||'null'}f=i.length===0?'[]':l?'[\n'+l+i.join(',\n'+l)+'\n'+j+']':'['+i.join(',')+']';l=j;return f}if(o&&typeof o==='object'){g=o.length;for(c=0;c<g;c+=1){d=o[c];if(typeof d==='string'){f=q(d,h);if(f){i.push(r(d)+(l?': ':':')+f)}}}}else{for(d in h){if(Object.hasOwnProperty.call(h,d)){f=q(d,h);if(f){i.push(r(d)+(l?': ':':')+f)}}}}f=i.length===0?'{}':l?'{\n'+l+i.join(',\n'+l)+'\n'+j+'}':'{'+i.join(',')+'}';l=j;return f}}Faye.stringify=function(a,b,c){var d;l='';p='';if(typeof c==='number'){for(d=0;d<c;d+=1){p+=' '}}else if(typeof c==='string'){p=c}o=b;if(b&&typeof b!=='function'&&(typeof b!=='object'||typeof b.length!=='number')){throw new Error('JSON.stringify');}return q('',{'':a})};if(typeof JSON.stringify!=='function'){JSON.stringify=Faye.stringify}if(typeof JSON.parse!=='function'){JSON.parse=function(g,j){var i;function h(a,b){var c,d,f=a[b];if(f&&typeof f==='object'){for(c in f){if(Object.hasOwnProperty.call(f,c)){d=h(f,c);if(d!==undefined){f[c]=d}else{delete f[c]}}}}return j.call(a,b,f)}m.lastIndex=0;if(m.test(g)){g=g.replace(m,function(a){return'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4)})}if(/^[\],:{}\s]*$/.test(g.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,'@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']').replace(/(?:^|:|,)(?:\s*\[)+/g,''))){i=eval('('+g+')');return typeof j==='function'?h({'':i},''):i}throw new SyntaxError('JSON.parse');}}}());Faye.Transport.WebSocket=Faye.extend(Faye.Class(Faye.Transport,{UNCONNECTED:1,CONNECTING:2,CONNECTED:3,batching:false,request:function(b,c){if(b.length===0)return;this._i=this._i||{};for(var d=0,f=b.length;d<f;d++){this._i[b[d].id]=b[d]}this.withSocket(function(a){a.send(Faye.toJSON(b))})},withSocket:function(a,b){this.callback(a,b);this.connect()},close:function(){if(this._C)return;this._C=true;if(this._4)this._4.close()},connect:function(){if(this._C)return;this._1=this._1||this.UNCONNECTED;if(this._1!==this.UNCONNECTED)return;this._1=this.CONNECTING;var f=Faye.Transport.WebSocket.getClass();this._4=new f(Faye.Transport.WebSocket.getSocketUrl(this._b));var g=this;this._4.onopen=function(){g._1=g.CONNECTED;g.setDeferredStatus('succeeded',g._4);g.trigger('up')};this._4.onmessage=function(a){var b=[].concat(JSON.parse(a.data));for(var c=0,d=b.length;c<d;c++){delete g._i[b[c].id]}g.receive(b)};this._4.onclose=function(){var a=(g._1===g.CONNECTED);g.setDeferredStatus('deferred');g._1=g.UNCONNECTED;delete g._4;if(a)return g.resend();var b=g._7.retry*1000;Faye.ENV.setTimeout(function(){g.connect()},b);g.trigger('down')}},resend:function(){var c=Faye.map(this._i,function(a,b){return b});this.request(c)}}),{WEBSOCKET_TIMEOUT:1000,getSocketUrl:function(a){if(Faye.URI)a=Faye.URI.parse(a).toURL();return a.replace(/^http(s?):/ig,'ws$1:')},getClass:function(){return(Faye.WebSocket&&Faye.WebSocket.Client)||Faye.ENV.WebSocket||Faye.ENV.MozWebSocket},isUsable:function(a,b,c){var d=this.getClass();if(!d)return b.call(c,false);var f=false,g=false,j=this.getSocketUrl(a),i=new d(j);i.onopen=function(){f=true;i.close();b.call(c,true);g=true;i=null};var h=function(){if(!g&&!f)b.call(c,false);g=true};i.onclose=i.onerror=h;Faye.ENV.setTimeout(h,this.WEBSOCKET_TIMEOUT)}});Faye.extend(Faye.Transport.WebSocket.prototype,Faye.Deferrable);Faye.Transport.register('websocket',Faye.Transport.WebSocket);Faye.Transport.EventSource=Faye.extend(Faye.Class(Faye.Transport,{initialize:function(b,c){Faye.Transport.prototype.initialize.call(this,b,c);this._K=new Faye.Transport.XHR(b,c);var d=new EventSource(c+'/'+b.getClientId()),f=this;d.onopen=function(){f.trigger('up')};d.onerror=function(){f.trigger('down')};d.onmessage=function(a){f.receive(JSON.parse(a.data))};this._4=d},request:function(a,b){this._K.request(a,b)},close:function(){this._4.close()}}),{isUsable:function(b,c,d){Faye.Transport.XHR.isUsable(b,function(a){c.call(d,a&&Faye.ENV.EventSource)})}});Faye.Transport.register('eventsource',Faye.Transport.EventSource);Faye.Transport.XHR=Faye.extend(Faye.Class(Faye.Transport,{request:function(d,f){var g=this.retry(d,f),j=Faye.URI.parse(this._b).pathname,i=this,h=Faye.ENV.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();h.open('POST',j,true);h.setRequestHeader('Content-Type','application/json');h.setRequestHeader('X-Requested-With','XMLHttpRequest');var k=this.headers;for(var m in k){if(!k.hasOwnProperty(m))continue;h.setRequestHeader(m,k[m])}var n=function(){h.abort()};Faye.Event.on(Faye.ENV,'beforeunload',n);var l=function(){Faye.Event.detach(Faye.ENV,'beforeunload',n);h.onreadystatechange=function(){};h=null};h.onreadystatechange=function(){if(h.readyState!==4)return;var a=null,b=h.status,c=((b>=200&&b<300)||b===304||b===1223);if(!c){l();g();return i.trigger('down')}try{a=JSON.parse(h.responseText)}catch(e){}l();if(a){i.receive(a);i.trigger('up')}else{g();i.trigger('down')}};h.send(Faye.toJSON(d))}}),{isUsable:function(a,b,c){b.call(c,Faye.URI.parse(a).isLocal())}});Faye.Transport.register('long-polling',Faye.Transport.XHR);Faye.Transport.CORS=Faye.extend(Faye.Class(Faye.Transport,{request:function(b,c){var d=Faye.ENV.XDomainRequest?XDomainRequest:XMLHttpRequest,f=new d(),g=this.retry(b,c),j=this;f.open('POST',this._b,true);var i=function(){if(!f)return false;f.onload=f.onerror=f.ontimeout=f.onprogress=null;f=null;Faye.ENV.clearTimeout(k);return true};f.onload=function(){var a=null;try{a=JSON.parse(f.responseText)}catch(e){}i();if(a){j.receive(a);j.trigger('up')}else{g();j.trigger('down')}};var h=function(){i();g();j.trigger('down')};var k=Faye.ENV.setTimeout(h,1.5*1000*c);f.onerror=h;f.ontimeout=h;f.onprogress=function(){};f.send('message='+encodeURIComponent(Faye.toJSON(b)))}}),{isUsable:function(a,b,c){if(Faye.URI.parse(a).isLocal())return b.call(c,false);if(Faye.ENV.XDomainRequest)return b.call(c,true);if(Faye.ENV.XMLHttpRequest){var d=new Faye.ENV.XMLHttpRequest();return b.call(c,d.withCredentials!==undefined)}return b.call(c,false)}});Faye.Transport.register('cross-origin-long-polling',Faye.Transport.CORS);Faye.Transport.JSONP=Faye.extend(Faye.Class(Faye.Transport,{request:function(b,c){var d={message:Faye.toJSON(b)},f=document.getElementsByTagName('head')[0],g=document.createElement('script'),j=Faye.Transport.JSONP.getCallbackName(),i=Faye.URI.parse(this._b,d),h=this.retry(b,c),k=this;Faye.ENV[j]=function(a){n();k.receive(a);k.trigger('up')};var m=Faye.ENV.setTimeout(function(){n();h();k.trigger('down')},1.5*1000*c);var n=function(){if(!Faye.ENV[j])return false;Faye.ENV[j]=undefined;try{delete Faye.ENV[j]}catch(e){}Faye.ENV.clearTimeout(m);g.parentNode.removeChild(g);return true};i.params.jsonp=j;g.type='text/javascript';g.src=i.toURL();f.appendChild(g)}}),{_D:0,getCallbackName:function(){this._D+=1;return'__jsonp'+this._D+'__'},isUsable:function(a,b,c){b.call(c,true)}});Faye.Transport.register('callback-polling',Faye.Transport.JSONP);
|
1
|
+
var Faye=(typeof Faye==='object')?Faye:{};if(typeof window!=='undefined')window.Faye=Faye;Faye.extend=function(a,b,d){if(!b)return a;for(var f in b){if(!b.hasOwnProperty(f))continue;if(a.hasOwnProperty(f)&&d===false)continue;if(a[f]!==b[f])a[f]=b[f]}return a};Faye.extend(Faye,{VERSION:'0.8.3',BAYEUX_VERSION:'1.0',ID_LENGTH:128,JSONP_CALLBACK:'jsonpcallback',CONNECTION_TYPES:['long-polling','cross-origin-long-polling','callback-polling','websocket','eventsource','in-process'],MANDATORY_CONNECTION_TYPES:['long-polling','callback-polling','in-process'],ENV:(function(){return this})(),random:function(a){a=a||this.ID_LENGTH;if(a>32){var b=Math.ceil(a/32),d='';while(b--)d+=this.random(32);return d}var f=Math.pow(2,a)-1,g=f.toString(36).length,d=Math.floor(Math.random()*f).toString(36);while(d.length<g)d='0'+d;return d},clientIdFromMessages:function(a){var b=[].concat(a)[0];return b&&b.clientId},copyObject:function(a){var b,d,f;if(a instanceof Array){b=[];d=a.length;while(d--)b[d]=Faye.copyObject(a[d]);return b}else if(typeof a==='object'){b=(a===null)?null:{};for(f in a)b[f]=Faye.copyObject(a[f]);return b}else{return a}},commonElement:function(a,b){for(var d=0,f=a.length;d<f;d++){if(this.indexOf(b,a[d])!==-1)return a[d]}return null},indexOf:function(a,b){if(a.indexOf)return a.indexOf(b);for(var d=0,f=a.length;d<f;d++){if(a[d]===b)return d}return-1},map:function(a,b,d){if(a.map)return a.map(b,d);var f=[];if(a instanceof Array){for(var g=0,h=a.length;g<h;g++){f.push(b.call(d||null,a[g],g))}}else{for(var k in a){if(!a.hasOwnProperty(k))continue;f.push(b.call(d||null,k,a[k]))}}return f},filter:function(a,b,d){var f=[];for(var g=0,h=a.length;g<h;g++){if(b.call(d||null,a[g],g))f.push(a[g])}return f},asyncEach:function(a,b,d,f){var g=a.length,h=-1,k=0,j=false;var i=function(){k-=1;h+=1;if(h===g)return d&&d.call(f);b(a[h],n)};var l=function(){if(j)return;j=true;while(k>0)i();j=false};var n=function(){k+=1;l()};n()},toJSON:function(a){if(this.stringify)return this.stringify(a,function(key,value){return(this[key]instanceof Array)?this[key]:value});return JSON.stringify(a)},logger:function(a){if(typeof console!=='undefined')console.log(a)},timestamp:function(){var b=new Date(),d=b.getFullYear(),f=b.getMonth()+1,g=b.getDate(),h=b.getHours(),k=b.getMinutes(),j=b.getSeconds();var i=function(a){return a<10?'0'+a:String(a)};return i(d)+'-'+i(f)+'-'+i(g)+' '+i(h)+':'+i(k)+':'+i(j)}});Faye.Class=function(a,b){if(typeof a!=='function'){b=a;a=Object}var d=function(){if(!this.initialize)return this;return this.initialize.apply(this,arguments)||this};var f=function(){};f.prototype=a.prototype;d.prototype=new f();Faye.extend(d.prototype,b);return d};Faye.Namespace=Faye.Class({initialize:function(){this._d={}},exists:function(a){return this._d.hasOwnProperty(a)},generate:function(){var a=Faye.random();while(this._d.hasOwnProperty(a))a=Faye.random();return this._d[a]=a},release:function(a){delete this._d[a]}});Faye.Error=Faye.Class({initialize:function(a,b,d){this.code=a;this.params=Array.prototype.slice.call(b);this.message=d},toString:function(){return this.code+':'+this.params.join(',')+':'+this.message}});Faye.Error.parse=function(a){a=a||'';if(!Faye.Grammar.ERROR.test(a))return new this(null,[],a);var b=a.split(':'),d=parseInt(b[0]),f=b[1].split(','),a=b[2];return new this(d,f,a)};Faye.Error.versionMismatch=function(){return new this(300,arguments,"Version mismatch").toString()};Faye.Error.conntypeMismatch=function(){return new this(301,arguments,"Connection types not supported").toString()};Faye.Error.extMismatch=function(){return new this(302,arguments,"Extension mismatch").toString()};Faye.Error.badRequest=function(){return new this(400,arguments,"Bad request").toString()};Faye.Error.clientUnknown=function(){return new this(401,arguments,"Unknown client").toString()};Faye.Error.parameterMissing=function(){return new this(402,arguments,"Missing required parameter").toString()};Faye.Error.channelForbidden=function(){return new this(403,arguments,"Forbidden channel").toString()};Faye.Error.channelUnknown=function(){return new this(404,arguments,"Unknown channel").toString()};Faye.Error.channelInvalid=function(){return new this(405,arguments,"Invalid channel").toString()};Faye.Error.extUnknown=function(){return new this(406,arguments,"Unknown extension").toString()};Faye.Error.publishFailed=function(){return new this(407,arguments,"Failed to publish").toString()};Faye.Error.serverError=function(){return new this(500,arguments,"Internal server error").toString()};Faye.Deferrable={callback:function(a,b){if(!a)return;if(this._v==='succeeded')return a.apply(b,this._k);this._l=this._l||[];this._l.push([a,b])},timeout:function(a,b){var d=this;var f=Faye.ENV.setTimeout(function(){d.setDeferredStatus('failed',b)},a*1000);this._w=f},errback:function(a,b){if(!a)return;if(this._v==='failed')return a.apply(b,this._k);this._m=this._m||[];this._m.push([a,b])},setDeferredStatus:function(){if(this._w)Faye.ENV.clearTimeout(this._w);var a=Array.prototype.slice.call(arguments),b=a.shift(),d;this._v=b;this._k=a;if(b==='succeeded')d=this._l;else if(b==='failed')d=this._m;if(!d)return;var f;while(f=d.shift())f[0].apply(f[1],this._k)}};Faye.Publisher={countListeners:function(a){if(!this._3||!this._3[a])return 0;return this._3[a].length},bind:function(a,b,d){this._3=this._3||{};var f=this._3[a]=this._3[a]||[];f.push([b,d])},unbind:function(a,b,d){if(!this._3||!this._3[a])return;if(!b){delete this._3[a];return}var f=this._3[a],g=f.length;while(g--){if(b!==f[g][0])continue;if(d&&f[g][1]!==d)continue;f.splice(g,1)}},trigger:function(){var a=Array.prototype.slice.call(arguments),b=a.shift();if(!this._3||!this._3[b])return;var d=this._3[b].slice(),f;for(var g=0,h=d.length;g<h;g++){f=d[g];f[0].apply(f[1],a)}}};Faye.Timeouts={addTimeout:function(a,b,d,f){this._5=this._5||{};if(this._5.hasOwnProperty(a))return;var g=this;this._5[a]=Faye.ENV.setTimeout(function(){delete g._5[a];d.call(f)},1000*b)},removeTimeout:function(a){this._5=this._5||{};var b=this._5[a];if(!b)return;clearTimeout(b);delete this._5[a]}};Faye.Logging={LOG_LEVELS:{error:3,warn:2,info:1,debug:0},logLevel:'error',log:function(a,b){if(!Faye.logger)return;var d=Faye.Logging.LOG_LEVELS;if(d[Faye.Logging.logLevel]>d[b])return;var a=Array.prototype.slice.apply(a),f=' ['+b.toUpperCase()+'] [Faye',g=this.className,h=a.shift().replace(/\?/g,function(){try{return Faye.toJSON(a.shift())}catch(e){return'[Object]'}});for(var k in Faye){if(g)continue;if(typeof Faye[k]!=='function')continue;if(this instanceof Faye[k])g=k}if(g)f+='.'+g;f+='] ';Faye.logger(Faye.timestamp()+f+h)}};(function(){for(var d in Faye.Logging.LOG_LEVELS)(function(a,b){Faye.Logging[a]=function(){this.log(arguments,a)}})(d,Faye.Logging.LOG_LEVELS[d])})();Faye.Grammar={LOWALPHA:/^[a-z]$/,UPALPHA:/^[A-Z]$/,ALPHA:/^([a-z]|[A-Z])$/,DIGIT:/^[0-9]$/,ALPHANUM:/^(([a-z]|[A-Z])|[0-9])$/,MARK:/^(\-|\_|\!|\~|\(|\)|\$|\@)$/,STRING:/^(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*$/,TOKEN:/^(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)))+$/,INTEGER:/^([0-9])+$/,CHANNEL_SEGMENT:/^(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)))+$/,CHANNEL_SEGMENTS:/^(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)))+(\/(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)))+)*$/,CHANNEL_NAME:/^\/(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)))+(\/(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)))+)*$/,WILD_CARD:/^\*{1,2}$/,CHANNEL_PATTERN:/^(\/(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)))+)*\/\*{1,2}$/,VERSION_ELEMENT:/^(([a-z]|[A-Z])|[0-9])(((([a-z]|[A-Z])|[0-9])|\-|\_))*$/,VERSION:/^([0-9])+(\.(([a-z]|[A-Z])|[0-9])(((([a-z]|[A-Z])|[0-9])|\-|\_))*)*$/,CLIENT_ID:/^((([a-z]|[A-Z])|[0-9]))+$/,ID:/^((([a-z]|[A-Z])|[0-9]))+$/,ERROR_MESSAGE:/^(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*$/,ERROR_ARGS:/^(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*(,(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*)*$/,ERROR_CODE:/^[0-9][0-9][0-9]$/,ERROR:/^([0-9][0-9][0-9]:(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*(,(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*)*:(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*|[0-9][0-9][0-9]::(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*)$/};Faye.Extensible={addExtension:function(a){this._6=this._6||[];this._6.push(a);if(a.added)a.added(this)},removeExtension:function(a){if(!this._6)return;var b=this._6.length;while(b--){if(this._6[b]!==a)continue;this._6.splice(b,1);if(a.removed)a.removed(this)}},pipeThroughExtensions:function(d,f,g,h){this.debug('Passing through ? extensions: ?',d,f);if(!this._6)return g.call(h,f);var k=this._6.slice();var j=function(a){if(!a)return g.call(h,a);var b=k.shift();if(!b)return g.call(h,a);if(b[d])b[d](a,j);else j(a)};j(f)}};Faye.extend(Faye.Extensible,Faye.Logging);Faye.Channel=Faye.Class({initialize:function(a){this.id=this.name=a},push:function(a){this.trigger('message',a)},isUnused:function(){return this.countListeners('message')===0}});Faye.extend(Faye.Channel.prototype,Faye.Publisher);Faye.extend(Faye.Channel,{HANDSHAKE:'/meta/handshake',CONNECT:'/meta/connect',SUBSCRIBE:'/meta/subscribe',UNSUBSCRIBE:'/meta/unsubscribe',DISCONNECT:'/meta/disconnect',META:'meta',SERVICE:'service',expand:function(a){var b=this.parse(a),d=['/**',a];var f=b.slice();f[f.length-1]='*';d.push(this.unparse(f));for(var g=1,h=b.length;g<h;g++){f=b.slice(0,g);f.push('**');d.push(this.unparse(f))}return d},isValid:function(a){return Faye.Grammar.CHANNEL_NAME.test(a)||Faye.Grammar.CHANNEL_PATTERN.test(a)},parse:function(a){if(!this.isValid(a))return null;return a.split('/').slice(1)},unparse:function(a){return'/'+a.join('/')},isMeta:function(a){var b=this.parse(a);return b?(b[0]===this.META):null},isService:function(a){var b=this.parse(a);return b?(b[0]===this.SERVICE):null},isSubscribable:function(a){if(!this.isValid(a))return null;return!this.isMeta(a)&&!this.isService(a)},Set:Faye.Class({initialize:function(){this._2={}},getKeys:function(){var a=[];for(var b in this._2)a.push(b);return a},remove:function(a){delete this._2[a]},hasSubscription:function(a){return this._2.hasOwnProperty(a)},subscribe:function(a,b,d){if(!b)return;var f;for(var g=0,h=a.length;g<h;g++){f=a[g];var k=this._2[f]=this._2[f]||new Faye.Channel(f);k.bind('message',b,d)}},unsubscribe:function(a,b,d){var f=this._2[a];if(!f)return false;f.unbind('message',b,d);if(f.isUnused()){this.remove(a);return true}else{return false}},distributeMessage:function(a){var b=Faye.Channel.expand(a.channel);for(var d=0,f=b.length;d<f;d++){var g=this._2[b[d]];if(g)g.trigger('message',a.data)}}})});Faye.Publication=Faye.Class(Faye.Deferrable);Faye.Subscription=Faye.Class({initialize:function(a,b,d,f){this._7=a;this._2=b;this._n=d;this._o=f;this._x=false},cancel:function(){if(this._x)return;this._7.unsubscribe(this._2,this._n,this._o);this._x=true},unsubscribe:function(){this.cancel()}});Faye.extend(Faye.Subscription.prototype,Faye.Deferrable);Faye.Client=Faye.Class({UNCONNECTED:1,CONNECTING:2,CONNECTED:3,DISCONNECTED:4,HANDSHAKE:'handshake',RETRY:'retry',NONE:'none',CONNECTION_TIMEOUT:60.0,DEFAULT_RETRY:5.0,DEFAULT_ENDPOINT:'/bayeux',INTERVAL:0.0,initialize:function(a,b){this.info('New client created for ?',a);this._e=b||{};this.endpoint=a||this.DEFAULT_ENDPOINT;this.endpoints=this._e.endpoints||{};this._E=Faye.CookieJar&&new Faye.CookieJar();this._y={};this._p=[];this.retry=this._e.retry||this.DEFAULT_RETRY;this._z(Faye.MANDATORY_CONNECTION_TYPES);this._1=this.UNCONNECTED;this._2=new Faye.Channel.Set();this._f=0;this._q={};this._8={reconnect:this.RETRY,interval:1000*(this._e.interval||this.INTERVAL),timeout:1000*(this._e.timeout||this.CONNECTION_TIMEOUT)};if(Faye.Event)Faye.Event.on(Faye.ENV,'beforeunload',function(){if(Faye.indexOf(this._p,'autodisconnect')<0)this.disconnect()},this)},disable:function(a){this._p.push(a)},setHeader:function(a,b){this._y[a]=b},getClientId:function(){return this._0},getState:function(){switch(this._1){case this.UNCONNECTED:return'UNCONNECTED';case this.CONNECTING:return'CONNECTING';case this.CONNECTED:return'CONNECTED';case this.DISCONNECTED:return'DISCONNECTED'}},handshake:function(f,g){if(this._8.reconnect===this.NONE)return;if(this._1!==this.UNCONNECTED)return;this._1=this.CONNECTING;var h=this;this.info('Initiating handshake with ?',this.endpoint);this._9({channel:Faye.Channel.HANDSHAKE,version:Faye.BAYEUX_VERSION,supportedConnectionTypes:[this._a.connectionType]},function(b){if(b.successful){this._1=this.CONNECTED;this._0=b.clientId;var d=Faye.filter(b.supportedConnectionTypes,function(a){return Faye.indexOf(this._p,a)<0},this);this._z(d);this.info('Handshake successful: ?',this._0);this.subscribe(this._2.getKeys(),true);if(f)f.call(g)}else{this.info('Handshake unsuccessful');Faye.ENV.setTimeout(function(){h.handshake(f,g)},this._8.interval);this._1=this.UNCONNECTED}},this)},connect:function(a,b){if(this._8.reconnect===this.NONE)return;if(this._1===this.DISCONNECTED)return;if(this._1===this.UNCONNECTED)return this.handshake(function(){this.connect(a,b)},this);this.callback(a,b);if(this._1!==this.CONNECTED)return;this.info('Calling deferred actions for ?',this._0);this.setDeferredStatus('succeeded');this.setDeferredStatus('deferred');if(this._r)return;this._r=true;this.info('Initiating connection for ?',this._0);this._9({channel:Faye.Channel.CONNECT,clientId:this._0,connectionType:this._a.connectionType},this._A,this)},disconnect:function(){if(this._1!==this.CONNECTED)return;this._1=this.DISCONNECTED;this.info('Disconnecting ?',this._0);this._9({channel:Faye.Channel.DISCONNECT,clientId:this._0},function(a){if(a.successful)this._a.close()},this);this.info('Clearing channel listeners for ?',this._0);this._2=new Faye.Channel.Set()},subscribe:function(d,f,g){if(d instanceof Array)return Faye.map(d,function(c){return this.subscribe(c,f,g)},this);var h=new Faye.Subscription(this,d,f,g),k=(f===true),j=this._2.hasSubscription(d);if(j&&!k){this._2.subscribe([d],f,g);h.setDeferredStatus('succeeded');return h}this.connect(function(){this.info('Client ? attempting to subscribe to ?',this._0,d);if(!k)this._2.subscribe([d],f,g);this._9({channel:Faye.Channel.SUBSCRIBE,clientId:this._0,subscription:d},function(a){if(!a.successful){h.setDeferredStatus('failed',Faye.Error.parse(a.error));return this._2.unsubscribe(d,f,g)}var b=[].concat(a.subscription);this.info('Subscription acknowledged for ? to ?',this._0,b);h.setDeferredStatus('succeeded')},this)},this);return h},unsubscribe:function(d,f,g){if(d instanceof Array)return Faye.map(d,function(c){return this.unsubscribe(c,f,g)},this);var h=this._2.unsubscribe(d,f,g);if(!h)return;this.connect(function(){this.info('Client ? attempting to unsubscribe from ?',this._0,d);this._9({channel:Faye.Channel.UNSUBSCRIBE,clientId:this._0,subscription:d},function(a){if(!a.successful)return;var b=[].concat(a.subscription);this.info('Unsubscription acknowledged for ? from ?',this._0,b)},this)},this)},publish:function(b,d){var f=new Faye.Publication();this.connect(function(){this.info('Client ? queueing published message to ?: ?',this._0,b,d);this._9({channel:b,data:d,clientId:this._0},function(a){if(a.successful)f.setDeferredStatus('succeeded');else f.setDeferredStatus('failed',Faye.Error.parse(a.error))},this)},this);return f},receiveMessage:function(d){this.pipeThroughExtensions('incoming',d,function(a){if(!a)return;if(a.advice)this._F(a.advice);this._G(a);if(a.successful===undefined)return;var b=this._q[a.id];if(!b)return;delete this._q[a.id];b[0].call(b[1],a)},this)},_z:function(b){Faye.Transport.get(this,b,function(a){this._a=a;this._a.cookies=this._E;this._a.headers=this._y;a.bind('down',function(){if(this._c!==undefined&&!this._c)return;this._c=false;this.trigger('transport:down')},this);a.bind('up',function(){if(this._c!==undefined&&this._c)return;this._c=true;this.trigger('transport:up')},this)},this)},_9:function(b,d,f){b.id=this._H();if(d)this._q[b.id]=[d,f];this.pipeThroughExtensions('outgoing',b,function(a){if(!a)return;this._a.send(a,this._8.timeout/1000)},this)},_H:function(){this._f+=1;if(this._f>=Math.pow(2,32))this._f=0;return this._f.toString(36)},_F:function(a){Faye.extend(this._8,a);if(this._8.reconnect===this.HANDSHAKE&&this._1!==this.DISCONNECTED){this._1=this.UNCONNECTED;this._0=null;this._A()}},_G:function(a){if(!a.channel||a.data===undefined)return;this.info('Client ? calling listeners for ? with ?',this._0,a.channel,a.data);this._2.distributeMessage(a)},_I:function(){if(!this._r)return;this._r=null;this.info('Closed connection for ?',this._0)},_A:function(){this._I();var a=this;Faye.ENV.setTimeout(function(){a.connect()},this._8.interval)}});Faye.extend(Faye.Client.prototype,Faye.Deferrable);Faye.extend(Faye.Client.prototype,Faye.Publisher);Faye.extend(Faye.Client.prototype,Faye.Logging);Faye.extend(Faye.Client.prototype,Faye.Extensible);Faye.Transport=Faye.extend(Faye.Class({MAX_DELAY:0.0,batching:true,initialize:function(a,b){this.debug('Created new ? transport for ?',this.connectionType,b);this._7=a;this._b=b;this._g=[]},close:function(){},send:function(a,b){this.debug('Client ? sending message to ?: ?',this._7._0,this._b,a);if(!this.batching)return this.request([a],b);this._g.push(a);this._J=b;if(a.channel===Faye.Channel.HANDSHAKE)return this.flush();if(a.channel===Faye.Channel.CONNECT)this._s=a;this.addTimeout('publish',this.MAX_DELAY,this.flush,this)},flush:function(){this.removeTimeout('publish');if(this._g.length>1&&this._s)this._s.advice={timeout:0};this.request(this._g,this._J);this._s=null;this._g=[]},receive:function(a){this.debug('Client ? received from ?: ?',this._7._0,this._b,a);for(var b=0,d=a.length;b<d;b++){this._7.receiveMessage(a[b])}},retry:function(a,b){var d=false,f=this._7.retry*1000,g=this;return function(){if(d)return;d=true;Faye.ENV.setTimeout(function(){g.request(a,b)},f)}}}),{get:function(k,j,i,l){var n=k.endpoint;if(j===undefined)j=this.supportedConnectionTypes();Faye.asyncEach(this._t,function(b,d){var f=b[0],g=b[1],h=k.endpoints[f]||n;if(Faye.indexOf(j,f)<0)return d();g.isUsable(h,function(a){if(a)i.call(l,new g(k,h));else d()})},function(){throw new Error('Could not find a usable connection type for '+n);})},register:function(a,b){this._t.push([a,b]);b.prototype.connectionType=a},_t:[],supportedConnectionTypes:function(){return Faye.map(this._t,function(a){return a[0]})}});Faye.extend(Faye.Transport.prototype,Faye.Logging);Faye.extend(Faye.Transport.prototype,Faye.Publisher);Faye.extend(Faye.Transport.prototype,Faye.Timeouts);Faye.Event={_h:[],on:function(a,b,d,f){var g=function(){d.call(f)};if(a.addEventListener)a.addEventListener(b,g,false);else a.attachEvent('on'+b,g);this._h.push({_i:a,_u:b,_n:d,_o:f,_B:g})},detach:function(a,b,d,f){var g=this._h.length,h;while(g--){h=this._h[g];if((a&&a!==h._i)||(b&&b!==h._u)||(d&&d!==h._n)||(f&&f!==h._o))continue;if(h._i.removeEventListener)h._i.removeEventListener(h._u,h._B,false);else h._i.detachEvent('on'+h._u,h._B);this._h.splice(g,1);h=null}}};Faye.Event.on(Faye.ENV,'unload',Faye.Event.detach,Faye.Event);Faye.URI=Faye.extend(Faye.Class({queryString:function(){var a=[];for(var b in this.params){if(!this.params.hasOwnProperty(b))continue;a.push(encodeURIComponent(b)+'='+encodeURIComponent(this.params[b]))}return a.join('&')},isLocal:function(){var a=Faye.URI.parse(Faye.ENV.location.href);var b=(a.hostname!==this.hostname)||(a.port!==this.port)||(a.protocol!==this.protocol);return!b},toURL:function(){var a=this.queryString();return this.protocol+this.hostname+(this.port?':'+this.port:'')+this.pathname+(a?'?'+a:'')}}),{parse:function(a,b){if(typeof a!=='string')return a;var d=document.createElement('a'),f=new this();d.href=a;f.protocol=d.protocol+'//';f.hostname=d.hostname;f.pathname=d.pathname.replace(/^\/?/,'/');if(d.port==='0'||d.port==='')f.port=(d.protocol==='https:')?'443':'80';else f.port=d.port;var g=d.search.replace(/^\?/,''),h=g?g.split('&'):[],k=h.length,j={},i;while(k--){i=h[k].split('=');j[decodeURIComponent(i[0]||'')]=decodeURIComponent(i[1]||'')}if(typeof b==='object')Faye.extend(j,b);f.params=j;return f}});if(!this.JSON){JSON={}}(function(){function l(a){return a<10?'0'+a:a}if(typeof Date.prototype.toJSON!=='function'){Date.prototype.toJSON=function(a){return this.getUTCFullYear()+'-'+l(this.getUTCMonth()+1)+'-'+l(this.getUTCDate())+'T'+l(this.getUTCHours())+':'+l(this.getUTCMinutes())+':'+l(this.getUTCSeconds())+'Z'};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(a){return this.valueOf()}}var n=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,o=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,m,q,t={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},p;function s(d){o.lastIndex=0;return o.test(d)?'"'+d.replace(o,function(a){var b=t[a];return typeof b==='string'?b:'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+d+'"'}function r(a,b){var d,f,g,h,k=m,j,i=b[a];if(i&&typeof i==='object'&&typeof i.toJSON==='function'){i=i.toJSON(a)}if(typeof p==='function'){i=p.call(b,a,i)}switch(typeof i){case'string':return s(i);case'number':return isFinite(i)?String(i):'null';case'boolean':case'null':return String(i);case'object':if(!i){return'null'}m+=q;j=[];if(Object.prototype.toString.apply(i)==='[object Array]'){h=i.length;for(d=0;d<h;d+=1){j[d]=r(d,i)||'null'}g=j.length===0?'[]':m?'[\n'+m+j.join(',\n'+m)+'\n'+k+']':'['+j.join(',')+']';m=k;return g}if(p&&typeof p==='object'){h=p.length;for(d=0;d<h;d+=1){f=p[d];if(typeof f==='string'){g=r(f,i);if(g){j.push(s(f)+(m?': ':':')+g)}}}}else{for(f in i){if(Object.hasOwnProperty.call(i,f)){g=r(f,i);if(g){j.push(s(f)+(m?': ':':')+g)}}}}g=j.length===0?'{}':m?'{\n'+m+j.join(',\n'+m)+'\n'+k+'}':'{'+j.join(',')+'}';m=k;return g}}Faye.stringify=function(a,b,d){var f;m='';q='';if(typeof d==='number'){for(f=0;f<d;f+=1){q+=' '}}else if(typeof d==='string'){q=d}p=b;if(b&&typeof b!=='function'&&(typeof b!=='object'||typeof b.length!=='number')){throw new Error('JSON.stringify');}return r('',{'':a})};if(typeof JSON.stringify!=='function'){JSON.stringify=Faye.stringify}if(typeof JSON.parse!=='function'){JSON.parse=function(h,k){var j;function i(a,b){var d,f,g=a[b];if(g&&typeof g==='object'){for(d in g){if(Object.hasOwnProperty.call(g,d)){f=i(g,d);if(f!==undefined){g[d]=f}else{delete g[d]}}}}return k.call(a,b,g)}n.lastIndex=0;if(n.test(h)){h=h.replace(n,function(a){return'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4)})}if(/^[\],:{}\s]*$/.test(h.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,'@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']').replace(/(?:^|:|,)(?:\s*\[)+/g,''))){j=eval('('+h+')');return typeof k==='function'?i({'':j},''):j}throw new SyntaxError('JSON.parse');}}}());Faye.Transport.WebSocket=Faye.extend(Faye.Class(Faye.Transport,{UNCONNECTED:1,CONNECTING:2,CONNECTED:3,batching:false,request:function(b,d){if(b.length===0)return;this._j=this._j||{};for(var f=0,g=b.length;f<g;f++){this._j[b[f].id]=b[f]}this.withSocket(function(a){a.send(Faye.toJSON(b))})},withSocket:function(a,b){this.callback(a,b);this.connect()},close:function(){if(this._C)return;this._C=true;if(this._4)this._4.close()},connect:function(){if(Faye.Transport.WebSocket._K)return;if(this._C)return;this._1=this._1||this.UNCONNECTED;if(this._1!==this.UNCONNECTED)return;this._1=this.CONNECTING;var g=Faye.Transport.WebSocket.getClass();this._4=new g(Faye.Transport.WebSocket.getSocketUrl(this._b));var h=this;this._4.onopen=function(){h._1=h.CONNECTED;h.setDeferredStatus('succeeded',h._4);h.trigger('up')};this._4.onmessage=function(a){var b=[].concat(JSON.parse(a.data));for(var d=0,f=b.length;d<f;d++){delete h._j[b[d].id]}h.receive(b)};this._4.onclose=function(){var a=(h._1===h.CONNECTED);h.setDeferredStatus('deferred');h._1=h.UNCONNECTED;delete h._4;if(a)return h.resend();var b=h._7.retry*1000;Faye.ENV.setTimeout(function(){h.connect()},b);h.trigger('down')}},resend:function(){var d=Faye.map(this._j,function(a,b){return b});this.request(d)}}),{WEBSOCKET_TIMEOUT:1000,getSocketUrl:function(a){if(Faye.URI)a=Faye.URI.parse(a).toURL();return a.replace(/^http(s?):/ig,'ws$1:')},getClass:function(){return(Faye.WebSocket&&Faye.WebSocket.Client)||Faye.ENV.WebSocket||Faye.ENV.MozWebSocket},isUsable:function(a,b,d){var f=this.getClass();if(!f)return b.call(d,false);var g=false,h=false,k=this.getSocketUrl(a),j=new f(k);j.onopen=function(){g=true;j.close();b.call(d,true);h=true;j=null};var i=function(){if(!h&&!g)b.call(d,false);h=true};j.onclose=j.onerror=i;Faye.ENV.setTimeout(i,this.WEBSOCKET_TIMEOUT)}});Faye.extend(Faye.Transport.WebSocket.prototype,Faye.Deferrable);Faye.Transport.register('websocket',Faye.Transport.WebSocket);if(Faye.Event)Faye.Event.on(Faye.ENV,'beforeunload',function(){Faye.Transport.WebSocket._K=true});Faye.Transport.EventSource=Faye.extend(Faye.Class(Faye.Transport,{initialize:function(b,d){Faye.Transport.prototype.initialize.call(this,b,d);this._L=new Faye.Transport.XHR(b,d);var f=new EventSource(d+'/'+b.getClientId()),g=this;f.onopen=function(){g.trigger('up')};f.onerror=function(){g.trigger('down')};f.onmessage=function(a){g.receive(JSON.parse(a.data))};this._4=f},request:function(a,b){this._L.request(a,b)},close:function(){this._4.close()}}),{isUsable:function(b,d,f){Faye.Transport.XHR.isUsable(b,function(a){d.call(f,a&&Faye.ENV.EventSource)})}});Faye.Transport.register('eventsource',Faye.Transport.EventSource);Faye.Transport.XHR=Faye.extend(Faye.Class(Faye.Transport,{request:function(f,g){var h=this.retry(f,g),k=Faye.URI.parse(this._b).pathname,j=this,i=Faye.ENV.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();i.open('POST',k,true);i.setRequestHeader('Content-Type','application/json');i.setRequestHeader('X-Requested-With','XMLHttpRequest');var l=this.headers;for(var n in l){if(!l.hasOwnProperty(n))continue;i.setRequestHeader(n,l[n])}var o=function(){i.abort()};Faye.Event.on(Faye.ENV,'beforeunload',o);var m=function(){Faye.Event.detach(Faye.ENV,'beforeunload',o);i.onreadystatechange=function(){};i=null};i.onreadystatechange=function(){if(i.readyState!==4)return;var a=null,b=i.status,d=((b>=200&&b<300)||b===304||b===1223);if(!d){m();h();return j.trigger('down')}try{a=JSON.parse(i.responseText)}catch(e){}m();if(a){j.receive(a);j.trigger('up')}else{h();j.trigger('down')}};i.send(Faye.toJSON(f))}}),{isUsable:function(a,b,d){b.call(d,Faye.URI.parse(a).isLocal())}});Faye.Transport.register('long-polling',Faye.Transport.XHR);Faye.Transport.CORS=Faye.extend(Faye.Class(Faye.Transport,{request:function(b,d){var f=Faye.ENV.XDomainRequest?XDomainRequest:XMLHttpRequest,g=new f(),h=this.retry(b,d),k=this;g.open('POST',this._b,true);var j=function(){if(!g)return false;g.onload=g.onerror=g.ontimeout=g.onprogress=null;g=null;Faye.ENV.clearTimeout(l);return true};g.onload=function(){var a=null;try{a=JSON.parse(g.responseText)}catch(e){}j();if(a){k.receive(a);k.trigger('up')}else{h();k.trigger('down')}};var i=function(){j();h();k.trigger('down')};var l=Faye.ENV.setTimeout(i,1.5*1000*d);g.onerror=i;g.ontimeout=i;g.onprogress=function(){};g.send('message='+encodeURIComponent(Faye.toJSON(b)))}}),{isUsable:function(a,b,d){if(Faye.URI.parse(a).isLocal())return b.call(d,false);if(Faye.ENV.XDomainRequest)return b.call(d,Faye.URI.parse(a).protocol===Faye.URI.parse(Faye.ENV.location).protocol);if(Faye.ENV.XMLHttpRequest){var f=new Faye.ENV.XMLHttpRequest();return b.call(d,f.withCredentials!==undefined)}return b.call(d,false)}});Faye.Transport.register('cross-origin-long-polling',Faye.Transport.CORS);Faye.Transport.JSONP=Faye.extend(Faye.Class(Faye.Transport,{request:function(b,d){var f={message:Faye.toJSON(b)},g=document.getElementsByTagName('head')[0],h=document.createElement('script'),k=Faye.Transport.JSONP.getCallbackName(),j=Faye.URI.parse(this._b,f),i=this.retry(b,d),l=this;Faye.ENV[k]=function(a){o();l.receive(a);l.trigger('up')};var n=Faye.ENV.setTimeout(function(){o();i();l.trigger('down')},1.5*1000*d);var o=function(){if(!Faye.ENV[k])return false;Faye.ENV[k]=undefined;try{delete Faye.ENV[k]}catch(e){}Faye.ENV.clearTimeout(n);h.parentNode.removeChild(h);return true};j.params.jsonp=k;h.type='text/javascript';h.src=j.toURL();g.appendChild(h)}}),{_D:0,getCallbackName:function(){this._D+=1;return'__jsonp'+this._D+'__'},isUsable:function(a,b,d){b.call(d,true)}});Faye.Transport.register('callback-polling',Faye.Transport.JSONP);
|
2
2
|
//@ sourceMappingURL=faye-browser-min.js.map
|
data/lib/faye-browser-min.js.map
CHANGED
@@ -3,6 +3,6 @@
|
|
3
3
|
"file": "faye-browser-min.js",
|
4
4
|
"sourceRoot": "",
|
5
5
|
"sources": ["faye-browser.js"],
|
6
|
-
"names": ["_advice", "_callback", "_callbacks", "_cancelled", "_cbCount", "_channels", "_client", "_clientId", "_closed", "_connectMessage", "_connectRequest", "_context", "_cookies", "_cycleConnection", "_deferredArgs", "_deferredStatus", "_deliverMessage", "_disabled", "_element", "_endpoint", "_errbacks", "_extensions", "_generateMessageId", "_handleAdvice", "_handler", "_headers", "_messageId", "_messages", "_options", "_outbox", "_registry", "_responseCallbacks", "_selectTransport", "_send", "_socket", "_state", "_subscribers", "_teardownConnection", "_this", "_timeout", "_timeouts", "_timer", "_transport", "_transportUp", "_transports", "_type", "_used", "_xhr", "abort", "advice", "args", "array", "banner", "bitlength", "bridge", "c", "callback", "callbackName", "callbacks", "called", "calls", "channel", "channels", "cleanUp", "client", "clone", "code", "
|
7
|
-
"mappings": "AAAA,IAAI,MAAQ,OAAO,QAAU,SAAW,QACxC,GAAI,OAAO,UAAY,WAAY,OAAO,KAAO,KAEjD,KAAK,OAAS,SAAS+E,EAAM8F,EAAQ/B,GACnC,IAAK+B,EAAQ,OAAO9F,EACpB,IAAK,IAAI6B,EAAI,GAAGiE,GACd,IAAKA,EAAO,eAAejE,GAAM,SACjC,GAAI7B,EAAK,eAAe6B,IAAQkC,IAAc,MAAO,SACrD,GAAI/D,EAAK6B,KAASiE,EAAOjE,GACvB7B,EAAK6B,GAAOiE,EAAOjE,GAEvB,OAAO7B,GAGT,KAAK,OAAO,MACV,gBAEA,qBACA,cACA,gBAAmB,eACnB,mBAAoB,KAAK,UAAW,MAAM,OAAO,KAAK,UAAW,SAAS,UAAW,YAAa,cAAe,GAAG,UAEpH,6BA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/D,EACxB6G,EAAO,MAAQ,KAAK,YACpBA,EAAO,IAAO9C,EAAS,QACvBzB,EAAK,YAAYuE,OAGnBlK,KAEA,gBAAiB,WACf,KAAKA,MACL,OAAQ,SAAW,KAAKA,IAAY,KAGtC,SAAU,SAAS6E,EAAUzB,EAAUe,GACrCf,EAAS,KAAKe,EAAS,SAI3B,KAAK,UAAU,UAAU,SAAS,SAAU,KAAK,UAAU;"
|
6
|
+
"names": ["_advice", "_callback", "_callbacks", "_cancelled", "_cbCount", "_channels", "_client", "_clientId", "_closed", "_connectMessage", "_connectRequest", "_context", "_cookies", "_cycleConnection", "_deferredArgs", "_deferredStatus", "_deliverMessage", "_disabled", "_element", "_endpoint", "_errbacks", "_extensions", "_generateMessageId", "_handleAdvice", "_handler", "_headers", "_messageId", "_messages", "_options", "_outbox", "_registry", "_responseCallbacks", "_selectTransport", "_send", "_socket", "_state", "_subscribers", "_teardownConnection", "_this", "_timeout", "_timeouts", "_timer", "_transport", "_transportUp", "_transports", "_type", "_unloaded", "_used", "_xhr", "a", "abort", "advice", "args", "array", "banner", "bitlength", "bridge", "c", "callback", "callbackName", "callbacks", "called", "calls", "channel", "channels", "cleanUp", "client", "clone", "code", "connEndpoint", "connType", "connected", "connectionTypes", "context", "copy", "cx", "data", "date", "day", "dead", "delay", "dest", "element", "endpoint", "escapable", "event", "eventName", "eventType", "extension", "extensions", "external", "f", "feature", "first", "force", "gap", "hasSubscribe", "head", "headers", "holder", "host", "hour", "i", "id", "indent", "isUsable", "iterate", "iterator", "k", "key", "keys", "klass", "length", "level", "levels", "limit", "list", "lista", "listb", "listener", "listeners", "location", "loop", "looping", "maxSize", "message", "messageArgs", "messages", "meta", "methods", "mind", "minute", "month", "msg", "n", "name", "names", "needle", "notconnected", "object", "onerror", "options", "overwrite", "pad", "pair", "pairs", "params", "parent", "parsedMessage", "partial", "parts", "path", "pipe", "publication", "query", "quote", "register", "rep", "replacer", "response", "responses", "result", "resume", "retry", "reviver", "script", "second", "seconds", "segments", "self", "socket", "socketUrl", "source", "space", "stage", "status", "str", "string", "subscription", "successful", "text", "timeout", "timer", "transport", "transportTypes", "type", "uri", "url", "usable", "v", "value", "walk", "wasConnected", "wrapped", "ws", "xhr", "xhrClass", "year"],
|
7
|
+
"mappings": "AAAA,IAAI,MAAQ,OAAO,QAAU,SAAW,QACxC,GAAI,OAAO,UAAY,WAAY,OAAO,KAAO,KAEjD,KAAK,OAAS,SAASiF,EAAM2F,EAAQ9B,GACnC,IAAK8B,EAAQ,OAAO3F,EACpB,IAAK,IAAI4B,EAAI,GAAG+D,GACd,IAAKA,EAAO,eAAe/D,GAAM,SACjC,GAAI5B,EAAK,eAAe4B,IAAQiC,IAAc,MAAO,SACrD,GAAI7D,EAAK4B,KAAS+D,EAAO/D,GACvB5B,EAAK4B,GAAO+D,EAAO/D,GAEvB,OAAO5B,GAGT,KAAK,OAAO,MACV,gBAEA,qBACA,cACA,gBAAmB,eACnB,mBAAoB,KAAK,UAAW,MAAM,OAAO,KAAK,UAAW,SAAS,UAAW,YAAa,cAAe,GAAG,UAEpH,6BAA8B,KAAK,UAAW,SAAS,UAAW,GAAG,UAErE,KAAM,WAAa,OAAO,SAE1B,OAAQ,SAAS1B,GACfA,EAAYA,GAAa,KAAK,UAC9B,GAAIA,MACF,IAAI+F,EAAS,KAAK,KAAK/F,MACnB0H,KACJ,MAAO3B,IAAS2B,GAAU,KAAK,WAC/B,OAAOA,EAET,IAAI9D,EAAU,KAAK,MAAO5D,KACtBqE,EAAUT,EAAM,aAAa,OAC7B8D,EAAU,KAAK,MAAM,KAAK,SAAW9D,GAAO,aAEhD,MAAO8D,EAAO,OAASrD,EAASqD,MAAeA,EAC/C,OAAOA,GAGT,qBAAsB,SAASlD,GAC7B,IAAIlC,KAAW,OAAOkC,MACtB,OAAOlC,GAASA,EAAM,UAGxB,WAAY,SAAS8C,GACnB,IAAIxE,EAAOmC,EAAGO,EACd,GAAI8B,EAAO,WAAW,OACpBxE,KACAmC,EAAIqC,EAA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AS,SAASoD,EAASwD,GACzB,IAAInC,GAAgB,QAAS,KAAK,OAAOrB,IACrC5B,EAAe,SAAS,sBAAsB,UAC9CoE,EAAe,SAAS,eAAe,SACvC1G,EAAe,KAAK,UAAU,MAAM,kBACpC8D,EAAe,KAAK,IAAI,MAAM,KAAKtG,GAAW+H,GAC9CiB,EAAe,KAAK,MAAMtC,EAASwD,GACnCZ,EAAe,KAEnB,KAAK,IAAI9G,GAAgB,SAASiB,GAChCX,IACAwG,EAAK,QAAQ7F,GACb6F,EAAK,SAAS,MAGhB,IAAIa,EAAQ,KAAK,IAAI,WAAW,WAC9BrH,IACAkG,IACAM,EAAK,SAAS,iBACAY,GAEhB,IAAIpH,EAAU,WACZ,IAAK,KAAK,IAAIN,GAAe,OAAO,MACpC,KAAK,IAAIA,GAAgB,UACzB,IAAM,OAAO,KAAK,IAAIA,GAAgB,MAAO,IAC7C,KAAK,IAAI,aAAa2H,GACtBjB,EAAO,WAAW,YAAYA,GAC9B,OAAO,MAGT5C,EAAS,OAAO,MAAQ9D,EACxB0G,EAAO,MAAQ,KAAK,YACpBA,EAAO,IAAO5C,EAAS,QACvBxB,EAAK,YAAYoE,OAGnBjK,KAEA,gBAAiB,WACf,KAAKA,MACL,OAAQ,SAAW,KAAKA,IAAY,KAGtC,SAAU,SAAS+E,EAAUzB,EAAUe,GACrCf,EAAS,KAAKe,EAAS,SAI3B,KAAK,UAAU,UAAU,SAAS,SAAU,KAAK,UAAU;"
|
8
8
|
}
|
data/lib/faye-browser.js
CHANGED
@@ -13,7 +13,7 @@ Faye.extend = function(dest, source, overwrite) {
|
|
13
13
|
};
|
14
14
|
|
15
15
|
Faye.extend(Faye, {
|
16
|
-
VERSION: '0.8.
|
16
|
+
VERSION: '0.8.3',
|
17
17
|
|
18
18
|
BAYEUX_VERSION: '1.0',
|
19
19
|
ID_LENGTH: 128,
|
@@ -715,10 +715,11 @@ Faye.Client = Faye.Class({
|
|
715
715
|
initialize: function(endpoint, options) {
|
716
716
|
this.info('New client created for ?', endpoint);
|
717
717
|
|
718
|
+
this._options = options || {};
|
718
719
|
this.endpoint = endpoint || this.DEFAULT_ENDPOINT;
|
720
|
+
this.endpoints = this._options.endpoints || {};
|
719
721
|
this._cookies = Faye.CookieJar && new Faye.CookieJar();
|
720
722
|
this._headers = {};
|
721
|
-
this._options = options || {};
|
722
723
|
this._disabled = [];
|
723
724
|
this.retry = this._options.retry || this.DEFAULT_RETRY;
|
724
725
|
|
@@ -893,12 +894,10 @@ Faye.Client = Faye.Class({
|
|
893
894
|
// * id
|
894
895
|
// * timestamp
|
895
896
|
subscribe: function(channel, callback, context) {
|
896
|
-
if (channel instanceof Array)
|
897
|
-
|
898
|
-
this.subscribe(
|
899
|
-
}
|
900
|
-
return;
|
901
|
-
}
|
897
|
+
if (channel instanceof Array)
|
898
|
+
return Faye.map(channel, function(c) {
|
899
|
+
return this.subscribe(c, callback, context);
|
900
|
+
}, this);
|
902
901
|
|
903
902
|
var subscription = new Faye.Subscription(this, channel, callback, context),
|
904
903
|
force = (callback === true),
|
@@ -945,12 +944,10 @@ Faye.Client = Faye.Class({
|
|
945
944
|
// * id
|
946
945
|
// * timestamp
|
947
946
|
unsubscribe: function(channel, callback, context) {
|
948
|
-
if (channel instanceof Array)
|
949
|
-
|
950
|
-
this.unsubscribe(
|
951
|
-
}
|
952
|
-
return;
|
953
|
-
}
|
947
|
+
if (channel instanceof Array)
|
948
|
+
return Faye.map(channel, function(c) {
|
949
|
+
return this.unsubscribe(c, callback, context);
|
950
|
+
}, this);
|
954
951
|
|
955
952
|
var dead = this._channels.unsubscribe(channel, callback, context);
|
956
953
|
if (!dead) return;
|
@@ -1157,11 +1154,13 @@ Faye.Transport = Faye.extend(Faye.Class({
|
|
1157
1154
|
if (connectionTypes === undefined) connectionTypes = this.supportedConnectionTypes();
|
1158
1155
|
|
1159
1156
|
Faye.asyncEach(this._transports, function(pair, resume) {
|
1160
|
-
var connType
|
1157
|
+
var connType = pair[0], klass = pair[1],
|
1158
|
+
connEndpoint = client.endpoints[connType] || endpoint;
|
1159
|
+
|
1161
1160
|
if (Faye.indexOf(connectionTypes, connType) < 0) return resume();
|
1162
1161
|
|
1163
|
-
klass.isUsable(
|
1164
|
-
if (isUsable) callback.call(context, new klass(client,
|
1162
|
+
klass.isUsable(connEndpoint, function(isUsable) {
|
1163
|
+
if (isUsable) callback.call(context, new klass(client, connEndpoint));
|
1165
1164
|
else resume();
|
1166
1165
|
});
|
1167
1166
|
}, function() {
|
@@ -1253,41 +1252,32 @@ Faye.URI = Faye.extend(Faye.Class({
|
|
1253
1252
|
|
1254
1253
|
toURL: function() {
|
1255
1254
|
var query = this.queryString();
|
1256
|
-
return this.protocol + this.hostname + ':' + this.port +
|
1255
|
+
return this.protocol + this.hostname + (this.port ? ':' + this.port : '') +
|
1257
1256
|
this.pathname + (query ? '?' + query : '');
|
1258
1257
|
}
|
1259
1258
|
}), {
|
1260
1259
|
parse: function(url, params) {
|
1261
1260
|
if (typeof url !== 'string') return url;
|
1262
1261
|
|
1263
|
-
var
|
1264
|
-
|
1265
|
-
var consume = function(name, pattern) {
|
1266
|
-
url = url.replace(pattern, function(match) {
|
1267
|
-
if (match) location[name] = match;
|
1268
|
-
return '';
|
1269
|
-
});
|
1270
|
-
};
|
1271
|
-
consume('protocol', /^https?\:\/+/);
|
1272
|
-
consume('hostname', /^[^\/\:]+/);
|
1273
|
-
consume('port', /^:[0-9]+/);
|
1262
|
+
var a = document.createElement('a'),
|
1263
|
+
uri = new this();
|
1274
1264
|
|
1275
|
-
|
1276
|
-
protocol: Faye.ENV.location.protocol + '//',
|
1277
|
-
hostname: Faye.ENV.location.hostname,
|
1278
|
-
port: Faye.ENV.location.port
|
1279
|
-
}, false);
|
1265
|
+
a.href = url;
|
1280
1266
|
|
1281
|
-
|
1282
|
-
|
1267
|
+
uri.protocol = a.protocol + '//';
|
1268
|
+
uri.hostname = a.hostname;
|
1269
|
+
uri.pathname = a.pathname.replace(/^\/?/, '/');
|
1283
1270
|
|
1284
|
-
|
1285
|
-
|
1286
|
-
|
1271
|
+
if (a.port === '0' || a.port === '')
|
1272
|
+
uri.port = (a.protocol === 'https:') ? '443' : '80';
|
1273
|
+
else
|
1274
|
+
uri.port = a.port;
|
1287
1275
|
|
1276
|
+
var query = a.search.replace(/^\?/, ''),
|
1288
1277
|
pairs = query ? query.split('&') : [],
|
1289
1278
|
n = pairs.length,
|
1290
|
-
data = {}
|
1279
|
+
data = {},
|
1280
|
+
parts;
|
1291
1281
|
|
1292
1282
|
while (n--) {
|
1293
1283
|
parts = pairs[n].split('=');
|
@@ -1295,10 +1285,9 @@ Faye.URI = Faye.extend(Faye.Class({
|
|
1295
1285
|
}
|
1296
1286
|
if (typeof params === 'object') Faye.extend(data, params);
|
1297
1287
|
|
1298
|
-
|
1299
|
-
location.params = data;
|
1288
|
+
uri.params = data;
|
1300
1289
|
|
1301
|
-
return
|
1290
|
+
return uri;
|
1302
1291
|
}
|
1303
1292
|
});
|
1304
1293
|
|
@@ -1817,6 +1806,7 @@ Faye.Transport.WebSocket = Faye.extend(Faye.Class(Faye.Transport, {
|
|
1817
1806
|
},
|
1818
1807
|
|
1819
1808
|
connect: function() {
|
1809
|
+
if (Faye.Transport.WebSocket._unloaded) return;
|
1820
1810
|
if (this._closed) return;
|
1821
1811
|
|
1822
1812
|
this._state = this._state || this.UNCONNECTED;
|
@@ -1904,6 +1894,12 @@ Faye.Transport.WebSocket = Faye.extend(Faye.Class(Faye.Transport, {
|
|
1904
1894
|
Faye.extend(Faye.Transport.WebSocket.prototype, Faye.Deferrable);
|
1905
1895
|
Faye.Transport.register('websocket', Faye.Transport.WebSocket);
|
1906
1896
|
|
1897
|
+
if (Faye.Event)
|
1898
|
+
Faye.Event.on(Faye.ENV, 'beforeunload', function() {
|
1899
|
+
Faye.Transport.WebSocket._unloaded = true;
|
1900
|
+
});
|
1901
|
+
|
1902
|
+
|
1907
1903
|
Faye.Transport.EventSource = Faye.extend(Faye.Class(Faye.Transport, {
|
1908
1904
|
initialize: function(client, endpoint) {
|
1909
1905
|
Faye.Transport.prototype.initialize.call(this, client, endpoint);
|
@@ -2065,7 +2061,8 @@ Faye.Transport.CORS = Faye.extend(Faye.Class(Faye.Transport, {
|
|
2065
2061
|
return callback.call(context, false);
|
2066
2062
|
|
2067
2063
|
if (Faye.ENV.XDomainRequest)
|
2068
|
-
return callback.call(context,
|
2064
|
+
return callback.call(context, Faye.URI.parse(endpoint).protocol ===
|
2065
|
+
Faye.URI.parse(Faye.ENV.location).protocol);
|
2069
2066
|
|
2070
2067
|
if (Faye.ENV.XMLHttpRequest) {
|
2071
2068
|
var xhr = new Faye.ENV.XMLHttpRequest();
|
data/lib/faye.rb
CHANGED
@@ -94,14 +94,19 @@ module Faye
|
|
94
94
|
private
|
95
95
|
|
96
96
|
def handle_request(request)
|
97
|
-
json_msg = message_from_request(request)
|
97
|
+
unless json_msg = message_from_request(request)
|
98
|
+
error 'Received request with no message: ?', format_request(request)
|
99
|
+
return [400, TYPE_TEXT, ['Bad request']]
|
100
|
+
end
|
101
|
+
|
102
|
+
debug "Received message via HTTP #{request.request_method}: ?", json_msg
|
103
|
+
|
98
104
|
message = Yajl::Parser.parse(json_msg)
|
99
105
|
jsonp = request.params['jsonp'] || JSONP_CALLBACK
|
100
106
|
headers = request.get? ? TYPE_SCRIPT.dup : TYPE_JSON.dup
|
101
107
|
origin = request.env['HTTP_ORIGIN']
|
102
108
|
callback = request.env['async.callback']
|
103
109
|
|
104
|
-
debug 'Received ?: ?', request.env['REQUEST_METHOD'], json_msg
|
105
110
|
@server.flush_connection(message) if request.get?
|
106
111
|
|
107
112
|
headers['Access-Control-Allow-Origin'] = origin if origin
|
@@ -111,7 +116,8 @@ module Faye
|
|
111
116
|
response = Faye.to_json(replies)
|
112
117
|
response = "#{ jsonp }(#{ response });" if request.get?
|
113
118
|
headers['Content-Length'] = response.bytesize.to_s unless request.env[HTTP_X_NO_CONTENT_LENGTH]
|
114
|
-
|
119
|
+
headers['Connection'] = 'close'
|
120
|
+
debug 'HTTP response: ?', response
|
115
121
|
callback.call [200, headers, [response]]
|
116
122
|
end
|
117
123
|
|
@@ -127,10 +133,11 @@ module Faye
|
|
127
133
|
|
128
134
|
ws.onmessage = lambda do |event|
|
129
135
|
begin
|
136
|
+
debug "Received message via WebSocket[#{ws.version}]: ?", event.data
|
137
|
+
|
130
138
|
message = Yajl::Parser.parse(event.data)
|
131
139
|
client_id = Faye.client_id_from_messages(message)
|
132
140
|
|
133
|
-
debug "Received via WebSocket[#{ws.version}]: ?", message
|
134
141
|
@server.open_socket(client_id, ws)
|
135
142
|
|
136
143
|
@server.process(message, false) do |replies|
|
@@ -180,6 +187,17 @@ module Faye
|
|
180
187
|
end
|
181
188
|
end
|
182
189
|
|
190
|
+
def format_request(request)
|
191
|
+
request.body.rewind
|
192
|
+
string = "curl -X #{request.request_method.upcase}"
|
193
|
+
string << " '#{request.url}'"
|
194
|
+
if request.post?
|
195
|
+
string << " -H 'Content-Type: #{request.env['CONTENT_TYPE']}'"
|
196
|
+
string << " -d '#{request.body.read}'"
|
197
|
+
end
|
198
|
+
string
|
199
|
+
end
|
200
|
+
|
183
201
|
def handle_options(request)
|
184
202
|
headers = {
|
185
203
|
'Access-Control-Allow-Origin' => '*',
|
data/lib/faye/engines/proxy.rb
CHANGED
@@ -44,7 +44,11 @@ module Faye
|
|
44
44
|
|
45
45
|
engine_class = @options[:type] || Memory
|
46
46
|
@engine = engine_class.create(self, @options)
|
47
|
-
|
47
|
+
|
48
|
+
bind :disconnect do |client_id|
|
49
|
+
EM.add_timer(0.01) { close_connection(client_id) }
|
50
|
+
end
|
51
|
+
|
48
52
|
debug 'Created new engine: ?', @options
|
49
53
|
end
|
50
54
|
|
@@ -68,6 +72,8 @@ module Faye
|
|
68
72
|
|
69
73
|
def close_connection(client_id)
|
70
74
|
debug 'Closing connection for ?', client_id
|
75
|
+
conn = @connections[client_id]
|
76
|
+
conn.socket.close if conn and conn.socket
|
71
77
|
@connections.delete(client_id)
|
72
78
|
end
|
73
79
|
|
data/lib/faye/protocol/client.rb
CHANGED
@@ -18,15 +18,16 @@ module Faye
|
|
18
18
|
CONNECTION_TIMEOUT = 60.0
|
19
19
|
DEFAULT_RETRY = 5.0
|
20
20
|
|
21
|
-
attr_reader :endpoint, :client_id, :retry
|
21
|
+
attr_reader :endpoint, :endpoints, :client_id, :retry
|
22
22
|
|
23
23
|
def initialize(endpoint = nil, options = {})
|
24
24
|
info('New client created for ?', endpoint)
|
25
25
|
|
26
|
+
@options = options
|
26
27
|
@endpoint = endpoint || RackAdapter::DEFAULT_ENDPOINT
|
28
|
+
@endpoints = @options[:endpoints] || {}
|
27
29
|
@cookies = CookieJar::Jar.new
|
28
30
|
@headers = {}
|
29
|
-
@options = options
|
30
31
|
@disabled = []
|
31
32
|
@retry = @options[:retry] || DEFAULT_RETRY
|
32
33
|
|
@@ -190,9 +191,7 @@ module Faye
|
|
190
191
|
# * timestamp
|
191
192
|
def subscribe(channel, force = false, &block)
|
192
193
|
if Array === channel
|
193
|
-
return channel.
|
194
|
-
subscribe(channel, force, &block)
|
195
|
-
end
|
194
|
+
return channel.map { |c| subscribe(c, force, &block) }
|
196
195
|
end
|
197
196
|
|
198
197
|
subscription = Subscription.new(self, channel, block)
|
@@ -239,9 +238,7 @@ module Faye
|
|
239
238
|
# * timestamp
|
240
239
|
def unsubscribe(channel, &block)
|
241
240
|
if Array === channel
|
242
|
-
return channel.
|
243
|
-
unsubscribe(channel, &block)
|
244
|
-
end
|
241
|
+
return channel.map { |c| unsubscribe(c, &block) }
|
245
242
|
end
|
246
243
|
|
247
244
|
dead = @channels.unsubscribe(channel, block)
|
@@ -76,10 +76,11 @@ module Faye
|
|
76
76
|
connection_types ||= supported_connection_types
|
77
77
|
|
78
78
|
select = lambda do |(conn_type, klass), resume|
|
79
|
+
conn_endpoint = client.endpoints[conn_type] || endpoint
|
79
80
|
if connection_types.include?(conn_type)
|
80
|
-
klass.usable?(
|
81
|
+
klass.usable?(conn_endpoint) do |is_usable|
|
81
82
|
if is_usable
|
82
|
-
callback.call(klass.new(client,
|
83
|
+
callback.call(klass.new(client, conn_endpoint))
|
83
84
|
else
|
84
85
|
resume.call
|
85
86
|
end
|
@@ -313,20 +313,29 @@ JS.ENV.ClientSpec = JS.Test.describe("Client", function() { with(this) {
|
|
313
313
|
|
314
314
|
// The Bayeux spec says the server should accept a list of subscriptions
|
315
315
|
// in one message but the cometD server doesn't actually support this
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
316
|
+
describe("with an array of subscriptions", function() { with(this) {
|
317
|
+
it("sends multiple subscribe messages", function() { with(this) {
|
318
|
+
expect(transport, "send").given({
|
319
|
+
channel: "/meta/subscribe",
|
320
|
+
clientId: "fakeid",
|
321
|
+
subscription: "/foo",
|
322
|
+
id: instanceOf("string")
|
323
|
+
}, 60)
|
324
|
+
expect(transport, "send").given({
|
325
|
+
channel: "/meta/subscribe",
|
326
|
+
clientId: "fakeid",
|
327
|
+
subscription: "/bar",
|
328
|
+
id: instanceOf("string")
|
329
|
+
}, 60)
|
330
|
+
client.subscribe(["/foo", "/bar"])
|
331
|
+
}})
|
332
|
+
|
333
|
+
it("returns an array of subscriptions", function() { with(this) {
|
334
|
+
stub(transport, "send")
|
335
|
+
var subs = client.subscribe(["/foo", "/bar"])
|
336
|
+
assertEqual( 2, subs.length )
|
337
|
+
assertKindOf( Faye.Subscription, subs[0] )
|
338
|
+
}})
|
330
339
|
}})
|
331
340
|
|
332
341
|
describe("on successful response", function() { with(this) {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
JS.ENV.TransportSpec = JS.Test.describe("Transport", function() { with(this) {
|
2
2
|
before(function() { with(this) {
|
3
|
-
this.client = {endpoint: "http://example.com/"}
|
3
|
+
this.client = {endpoint: "http://example.com/", endpoints: {}}
|
4
4
|
|
5
5
|
if (Faye.Transport.NodeLocal) {
|
6
6
|
this.LocalTransport = Faye.Transport.NodeLocal
|
data/spec/ruby/client_spec.rb
CHANGED
@@ -316,20 +316,29 @@ describe Faye::Client do
|
|
316
316
|
|
317
317
|
# The Bayeux spec says the server should accept a list of subscriptions
|
318
318
|
# in one message but the cometD server doesn't actually support this
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
319
|
+
describe "with an array of subscriptions" do
|
320
|
+
it "sends multiple subscribe messages" do
|
321
|
+
transport.should_receive(:send).with({
|
322
|
+
"channel" => "/meta/subscribe",
|
323
|
+
"clientId" => "fakeid",
|
324
|
+
"subscription" => "/foo",
|
325
|
+
"id" => instance_of(String)
|
326
|
+
}, 60)
|
327
|
+
transport.should_receive(:send).with({
|
328
|
+
"channel" => "/meta/subscribe",
|
329
|
+
"clientId" => "fakeid",
|
330
|
+
"subscription" => "/bar",
|
331
|
+
"id" => instance_of(String)
|
332
|
+
}, 60)
|
333
|
+
@client.subscribe(["/foo", "/bar"])
|
334
|
+
end
|
335
|
+
|
336
|
+
it "returns an array of subscriptions" do
|
337
|
+
transport.stub(:send)
|
338
|
+
subs = @client.subscribe(["/foo", "/bar"])
|
339
|
+
subs.size.should == 2
|
340
|
+
subs.should be_all { |s| Faye::Subscription === s }
|
341
|
+
end
|
333
342
|
end
|
334
343
|
|
335
344
|
describe "on successful response" do
|
data/spec/ruby/transport_spec.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: faye
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-07-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: cookiejar
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,15 @@ dependencies:
|
|
21
21
|
version: 0.3.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.3.0
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: em-http-request
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ! '>='
|
@@ -32,10 +37,15 @@ dependencies:
|
|
32
37
|
version: 0.3.0
|
33
38
|
type: :runtime
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.3.0
|
36
46
|
- !ruby/object:Gem::Dependency
|
37
47
|
name: eventmachine
|
38
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
39
49
|
none: false
|
40
50
|
requirements:
|
41
51
|
- - ! '>='
|
@@ -43,10 +53,15 @@ dependencies:
|
|
43
53
|
version: 0.12.0
|
44
54
|
type: :runtime
|
45
55
|
prerelease: false
|
46
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.12.0
|
47
62
|
- !ruby/object:Gem::Dependency
|
48
63
|
name: faye-websocket
|
49
|
-
requirement:
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
50
65
|
none: false
|
51
66
|
requirements:
|
52
67
|
- - ! '>='
|
@@ -54,10 +69,15 @@ dependencies:
|
|
54
69
|
version: 0.4.0
|
55
70
|
type: :runtime
|
56
71
|
prerelease: false
|
57
|
-
version_requirements:
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 0.4.0
|
58
78
|
- !ruby/object:Gem::Dependency
|
59
79
|
name: rack
|
60
|
-
requirement:
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
61
81
|
none: false
|
62
82
|
requirements:
|
63
83
|
- - ! '>='
|
@@ -65,10 +85,15 @@ dependencies:
|
|
65
85
|
version: 1.0.0
|
66
86
|
type: :runtime
|
67
87
|
prerelease: false
|
68
|
-
version_requirements:
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 1.0.0
|
69
94
|
- !ruby/object:Gem::Dependency
|
70
95
|
name: yajl-ruby
|
71
|
-
requirement:
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
72
97
|
none: false
|
73
98
|
requirements:
|
74
99
|
- - ! '>='
|
@@ -76,10 +101,15 @@ dependencies:
|
|
76
101
|
version: 1.0.0
|
77
102
|
type: :runtime
|
78
103
|
prerelease: false
|
79
|
-
version_requirements:
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 1.0.0
|
80
110
|
- !ruby/object:Gem::Dependency
|
81
111
|
name: compass
|
82
|
-
requirement:
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
83
113
|
none: false
|
84
114
|
requirements:
|
85
115
|
- - ~>
|
@@ -87,10 +117,15 @@ dependencies:
|
|
87
117
|
version: 0.10.0
|
88
118
|
type: :development
|
89
119
|
prerelease: false
|
90
|
-
version_requirements:
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ~>
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: 0.10.0
|
91
126
|
- !ruby/object:Gem::Dependency
|
92
127
|
name: jake
|
93
|
-
requirement:
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
94
129
|
none: false
|
95
130
|
requirements:
|
96
131
|
- - ! '>='
|
@@ -98,10 +133,15 @@ dependencies:
|
|
98
133
|
version: 1.1.1
|
99
134
|
type: :development
|
100
135
|
prerelease: false
|
101
|
-
version_requirements:
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ! '>='
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: 1.1.1
|
102
142
|
- !ruby/object:Gem::Dependency
|
103
143
|
name: rake
|
104
|
-
requirement:
|
144
|
+
requirement: !ruby/object:Gem::Requirement
|
105
145
|
none: false
|
106
146
|
requirements:
|
107
147
|
- - ! '>='
|
@@ -109,10 +149,15 @@ dependencies:
|
|
109
149
|
version: '0'
|
110
150
|
type: :development
|
111
151
|
prerelease: false
|
112
|
-
version_requirements:
|
152
|
+
version_requirements: !ruby/object:Gem::Requirement
|
153
|
+
none: false
|
154
|
+
requirements:
|
155
|
+
- - ! '>='
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: '0'
|
113
158
|
- !ruby/object:Gem::Dependency
|
114
159
|
name: rspec
|
115
|
-
requirement:
|
160
|
+
requirement: !ruby/object:Gem::Requirement
|
116
161
|
none: false
|
117
162
|
requirements:
|
118
163
|
- - ~>
|
@@ -120,10 +165,15 @@ dependencies:
|
|
120
165
|
version: 2.8.0
|
121
166
|
type: :development
|
122
167
|
prerelease: false
|
123
|
-
version_requirements:
|
168
|
+
version_requirements: !ruby/object:Gem::Requirement
|
169
|
+
none: false
|
170
|
+
requirements:
|
171
|
+
- - ~>
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: 2.8.0
|
124
174
|
- !ruby/object:Gem::Dependency
|
125
175
|
name: rack-proxy
|
126
|
-
requirement:
|
176
|
+
requirement: !ruby/object:Gem::Requirement
|
127
177
|
none: false
|
128
178
|
requirements:
|
129
179
|
- - ! '>='
|
@@ -131,10 +181,15 @@ dependencies:
|
|
131
181
|
version: '0'
|
132
182
|
type: :development
|
133
183
|
prerelease: false
|
134
|
-
version_requirements:
|
184
|
+
version_requirements: !ruby/object:Gem::Requirement
|
185
|
+
none: false
|
186
|
+
requirements:
|
187
|
+
- - ! '>='
|
188
|
+
- !ruby/object:Gem::Version
|
189
|
+
version: '0'
|
135
190
|
- !ruby/object:Gem::Dependency
|
136
191
|
name: rack-test
|
137
|
-
requirement:
|
192
|
+
requirement: !ruby/object:Gem::Requirement
|
138
193
|
none: false
|
139
194
|
requirements:
|
140
195
|
- - ! '>='
|
@@ -142,10 +197,15 @@ dependencies:
|
|
142
197
|
version: '0'
|
143
198
|
type: :development
|
144
199
|
prerelease: false
|
145
|
-
version_requirements:
|
200
|
+
version_requirements: !ruby/object:Gem::Requirement
|
201
|
+
none: false
|
202
|
+
requirements:
|
203
|
+
- - ! '>='
|
204
|
+
- !ruby/object:Gem::Version
|
205
|
+
version: '0'
|
146
206
|
- !ruby/object:Gem::Dependency
|
147
207
|
name: rainbows
|
148
|
-
requirement:
|
208
|
+
requirement: !ruby/object:Gem::Requirement
|
149
209
|
none: false
|
150
210
|
requirements:
|
151
211
|
- - ! '>='
|
@@ -153,10 +213,15 @@ dependencies:
|
|
153
213
|
version: 1.0.0
|
154
214
|
type: :development
|
155
215
|
prerelease: false
|
156
|
-
version_requirements:
|
216
|
+
version_requirements: !ruby/object:Gem::Requirement
|
217
|
+
none: false
|
218
|
+
requirements:
|
219
|
+
- - ! '>='
|
220
|
+
- !ruby/object:Gem::Version
|
221
|
+
version: 1.0.0
|
157
222
|
- !ruby/object:Gem::Dependency
|
158
223
|
name: RedCloth
|
159
|
-
requirement:
|
224
|
+
requirement: !ruby/object:Gem::Requirement
|
160
225
|
none: false
|
161
226
|
requirements:
|
162
227
|
- - ~>
|
@@ -164,10 +229,15 @@ dependencies:
|
|
164
229
|
version: 3.0.0
|
165
230
|
type: :development
|
166
231
|
prerelease: false
|
167
|
-
version_requirements:
|
232
|
+
version_requirements: !ruby/object:Gem::Requirement
|
233
|
+
none: false
|
234
|
+
requirements:
|
235
|
+
- - ~>
|
236
|
+
- !ruby/object:Gem::Version
|
237
|
+
version: 3.0.0
|
168
238
|
- !ruby/object:Gem::Dependency
|
169
239
|
name: sinatra
|
170
|
-
requirement:
|
240
|
+
requirement: !ruby/object:Gem::Requirement
|
171
241
|
none: false
|
172
242
|
requirements:
|
173
243
|
- - ! '>='
|
@@ -175,10 +245,15 @@ dependencies:
|
|
175
245
|
version: '0'
|
176
246
|
type: :development
|
177
247
|
prerelease: false
|
178
|
-
version_requirements:
|
248
|
+
version_requirements: !ruby/object:Gem::Requirement
|
249
|
+
none: false
|
250
|
+
requirements:
|
251
|
+
- - ! '>='
|
252
|
+
- !ruby/object:Gem::Version
|
253
|
+
version: '0'
|
179
254
|
- !ruby/object:Gem::Dependency
|
180
255
|
name: staticmatic
|
181
|
-
requirement:
|
256
|
+
requirement: !ruby/object:Gem::Requirement
|
182
257
|
none: false
|
183
258
|
requirements:
|
184
259
|
- - ! '>='
|
@@ -186,10 +261,15 @@ dependencies:
|
|
186
261
|
version: '0'
|
187
262
|
type: :development
|
188
263
|
prerelease: false
|
189
|
-
version_requirements:
|
264
|
+
version_requirements: !ruby/object:Gem::Requirement
|
265
|
+
none: false
|
266
|
+
requirements:
|
267
|
+
- - ! '>='
|
268
|
+
- !ruby/object:Gem::Version
|
269
|
+
version: '0'
|
190
270
|
- !ruby/object:Gem::Dependency
|
191
271
|
name: thin
|
192
|
-
requirement:
|
272
|
+
requirement: !ruby/object:Gem::Requirement
|
193
273
|
none: false
|
194
274
|
requirements:
|
195
275
|
- - ! '>='
|
@@ -197,7 +277,12 @@ dependencies:
|
|
197
277
|
version: 1.2.0
|
198
278
|
type: :development
|
199
279
|
prerelease: false
|
200
|
-
version_requirements:
|
280
|
+
version_requirements: !ruby/object:Gem::Requirement
|
281
|
+
none: false
|
282
|
+
requirements:
|
283
|
+
- - ! '>='
|
284
|
+
- !ruby/object:Gem::Version
|
285
|
+
version: 1.2.0
|
201
286
|
description:
|
202
287
|
email: jcoglan@gmail.com
|
203
288
|
executables: []
|
@@ -298,7 +383,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
298
383
|
version: '0'
|
299
384
|
requirements: []
|
300
385
|
rubyforge_project:
|
301
|
-
rubygems_version: 1.8.
|
386
|
+
rubygems_version: 1.8.23
|
302
387
|
signing_key:
|
303
388
|
specification_version: 3
|
304
389
|
summary: Simple pub/sub messaging for the web
|