faye 1.0.4 → 1.1.0
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.
- checksums.yaml +5 -5
- data/CHANGELOG.md +12 -4
- data/README.md +10 -9
- data/lib/faye-browser-min.js +2 -1
- data/lib/faye-browser-min.js.map +1 -1
- data/lib/faye-browser.js +566 -343
- data/lib/faye.rb +10 -10
- data/lib/faye/adapters/rack_adapter.rb +29 -10
- data/lib/faye/engines/connection.rb +7 -7
- data/lib/faye/engines/memory.rb +7 -8
- data/lib/faye/engines/proxy.rb +14 -15
- data/lib/faye/error.rb +0 -1
- data/lib/faye/mixins/deferrable.rb +0 -1
- data/lib/faye/mixins/logging.rb +0 -1
- data/lib/faye/mixins/publisher.rb +0 -1
- data/lib/faye/mixins/timeouts.rb +0 -1
- data/lib/faye/protocol/channel.rb +2 -4
- data/lib/faye/protocol/client.rb +101 -154
- data/lib/faye/protocol/dispatcher.rb +170 -0
- data/lib/faye/protocol/extensible.rb +1 -2
- data/lib/faye/protocol/grammar.rb +0 -1
- data/lib/faye/protocol/scheduler.rb +43 -0
- data/lib/faye/protocol/server.rb +11 -22
- data/lib/faye/protocol/socket.rb +0 -1
- data/lib/faye/protocol/subscription.rb +0 -1
- data/lib/faye/transport/http.rb +41 -28
- data/lib/faye/transport/local.rb +4 -5
- data/lib/faye/transport/transport.rb +57 -36
- data/lib/faye/transport/web_socket.rb +38 -26
- data/lib/faye/util/namespace.rb +0 -1
- metadata +26 -10
- data/lib/faye/protocol/envelope.rb +0 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: caf00bf9ffb33a0903225d0493562e7b772a164f
|
4
|
+
data.tar.gz: 3203a01ca87aec05fb9095f564dfc853f103a3f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5656c924fb9ccd4d6b70f5d649e89e1543f764d65ebc12253af2c2aabb94d796311c3c6e2b2448adf7e9cf00d63dea831454134a21528e918c9962d1731deb72
|
7
|
+
data.tar.gz: 258b4e6db944ef3be8df315154d324b04579dd335fd03de65d7ade182f15ab85e78e1f4fa60ffd25666ba05ea9c7b51051ac5bbab9a1171548b07f69af23ef9e
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,16 @@
|
|
1
|
-
### 1.0
|
1
|
+
### 1.1.0 / 2014-12-22
|
2
2
|
|
3
|
-
*
|
4
|
-
*
|
3
|
+
* Allow the server and client to use WebSocket extensions, for example permessage-deflate
|
4
|
+
* Support the `HTTP_PROXY` and `HTTPS_PROXY` environment variables to send all client connections through an HTTP proxy
|
5
|
+
* Introduce the `Scheduler` API to allow the user to control message retries
|
6
|
+
* Add the `attempts` and `deadline` options to `Client#publish()`
|
7
|
+
* Let `RackAdapter` take a block that yields the instance, so extensions can be added to middleware
|
8
|
+
* Allow monitoring listeners to see the `clientId` on publishd messages but still avoid sending it to subscribers
|
9
|
+
* Return a promise from `Client#disconnect()`
|
10
|
+
* Fix client-side retry bugs causing the client to flood the server with duplicate messages
|
11
|
+
* Send all transport types in the `supportedConnectionTypes` handshake parameter
|
12
|
+
* Don't close WebSockets when the client recovers from an error and sends a new `clientId`
|
13
|
+
* Replace `cookiejar` with `tough-cookie` to avoid global variable leaks
|
5
14
|
|
6
15
|
|
7
16
|
### 1.0.3 / 2014-07-08
|
@@ -355,4 +364,3 @@
|
|
355
364
|
* Ruby Bayeux server and Rack adapter
|
356
365
|
* Internally evented using EventMachine, web frontend blocks
|
357
366
|
* JavaScript client with `long-polling` and `callback-polling`
|
358
|
-
|
data/README.md
CHANGED
@@ -14,21 +14,22 @@ applications, and clients that can be used on the server and in the browser.
|
|
14
14
|
|
15
15
|
(The MIT License)
|
16
16
|
|
17
|
-
Copyright (c) 2009-
|
17
|
+
Copyright (c) 2009-2014 James Coglan and contributors
|
18
18
|
|
19
19
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
20
20
|
this software and associated documentation files (the 'Software'), to deal in
|
21
21
|
the Software without restriction, including without limitation the rights to
|
22
|
-
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
23
|
-
the Software, and to permit persons to whom the Software is furnished to do
|
24
|
-
subject to the following conditions:
|
22
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
23
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
24
|
+
so, subject to the following conditions:
|
25
25
|
|
26
26
|
The above copyright notice and this permission notice shall be included in all
|
27
27
|
copies or substantial portions of the Software.
|
28
28
|
|
29
29
|
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
30
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
31
|
-
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
32
|
-
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
33
|
-
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
34
|
-
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
30
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
31
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
32
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
33
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
34
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
35
|
+
SOFTWARE.
|
data/lib/faye-browser-min.js
CHANGED
@@ -1,2 +1,3 @@
|
|
1
|
-
!function(){"use strict";var Faye={VERSION:"1.0.4",BAYEUX_VERSION:"1.0",ID_LENGTH:160,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:"undefined"!=typeof window?window:global,extend:function(e,t,n){if(!t)return e;for(var i in t)t.hasOwnProperty(i)&&(e.hasOwnProperty(i)&&!1===n||e[i]!==t[i]&&(e[i]=t[i]));return e},random:function(e){return e=e||this.ID_LENGTH,csprng(e,36)},clientIdFromMessages:function(e){var t=this.filter([].concat(e),function(e){return"/meta/connect"===e.channel});return t[0]&&t[0].clientId},copyObject:function(e){var t,n,i;if(e instanceof Array){for(t=[],n=e.length;n--;)t[n]=Faye.copyObject(e[n]);return t}if("object"==typeof e){t=null===e?null:{};for(i in e)t[i]=Faye.copyObject(e[i]);return t}return e},commonElement:function(e,t){for(var n=0,i=e.length;n<i;n++)if(-1!==this.indexOf(t,e[n]))return e[n];return null},indexOf:function(e,t){if(e.indexOf)return e.indexOf(t);for(var n=0,i=e.length;n<i;n++)if(e[n]===t)return n;return-1},map:function(e,t,n){if(e.map)return e.map(t,n);var i=[];if(e instanceof Array)for(var s=0,r=e.length;s<r;s++)i.push(t.call(n||null,e[s],s));else for(var o in e)e.hasOwnProperty(o)&&i.push(t.call(n||null,o,e[o]));return i},filter:function(e,t,n){if(e.filter)return e.filter(t,n);for(var i=[],s=0,r=e.length;s<r;s++)t.call(n||null,e[s],s)&&i.push(e[s]);return i},asyncEach:function(e,t,n,i){var s=e.length,r=-1,o=0,a=!1,c=function(){if(o-=1,(r+=1)===s)return n&&n.call(i);t(e[r],h)},u=function(){if(!a){for(a=!0;o>0;)c();a=!1}},h=function(){o+=1,u()};h()},toJSON:function(e){return this.stringify?this.stringify(e,function(e,t){return this[e]instanceof Array?this[e]:t}):JSON.stringify(e)}};"undefined"!=typeof module?module.exports=Faye:"undefined"!=typeof window&&(window.Faye=Faye),Faye.Class=function(e,t){"function"!=typeof e&&(t=e,e=Object);var n=function(){return this.initialize?this.initialize.apply(this,arguments)||this:this},i=function(){};return i.prototype=e.prototype,n.prototype=new i,Faye.extend(n.prototype,t),n},function(){function e(e,t){if(e.indexOf)return e.indexOf(t);for(var n=0;n<e.length;n++)if(t===e[n])return n;return-1}var t=Faye.EventEmitter=function(){},n="function"==typeof Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)};t.prototype.emit=function(e){if("error"===e&&(!this._events||!this._events.error||n(this._events.error)&&!this._events.error.length))throw arguments[1]instanceof Error?arguments[1]:Error("Uncaught, unspecified 'error' event.");if(!this._events)return!1;var t=this._events[e];if(!t)return!1;if("function"==typeof t){switch(arguments.length){case 1:t.call(this);break;case 2:t.call(this,arguments[1]);break;case 3:t.call(this,arguments[1],arguments[2]);break;default:var i=Array.prototype.slice.call(arguments,1);t.apply(this,i)}return!0}if(n(t)){for(var i=Array.prototype.slice.call(arguments,1),s=t.slice(),r=0,o=s.length;r<o;r++)s[r].apply(this,i);return!0}return!1},t.prototype.addListener=function(e,t){if("function"!=typeof t)throw Error("addListener only takes instances of Function");return this._events||(this._events={}),this.emit("newListener",e,t),this._events[e]?n(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,this},t.prototype.on=t.prototype.addListener,t.prototype.once=function(e,t){var n=this;return n.on(e,function i(){n.removeListener(e,i),t.apply(this,arguments)}),this},t.prototype.removeListener=function(t,i){if("function"!=typeof i)throw Error("removeListener only takes instances of Function");if(!this._events||!this._events[t])return this;var s=this._events[t];if(n(s)){var r=e(s,i);if(r<0)return this;s.splice(r,1),0==s.length&&delete this._events[t]}else this._events[t]===i&&delete this._events[t];return this},t.prototype.removeAllListeners=function(e){return 0===arguments.length?(this._events={},this):(e&&this._events&&this._events[e]&&(this._events[e]=null),this)},t.prototype.listeners=function(e){return this._events||(this._events={}),this._events[e]||(this._events[e]=[]),n(this._events[e])||(this._events[e]=[this._events[e]]),this._events[e]}}(),Faye.Namespace=Faye.Class({initialize:function(){this._used={}},exists:function(e){return this._used.hasOwnProperty(e)},generate:function(){for(var e=Faye.random();this._used.hasOwnProperty(e);)e=Faye.random();return this._used[e]=e},release:function(e){delete this._used[e]}}),function(){var e,t=setTimeout;e="function"==typeof setImmediate?function(e){setImmediate(e)}:"object"==typeof process&&process.nextTick?function(e){process.nextTick(e)}:function(e){t(e,0)};var n=0,i=1,s=2,r=function(e){return e},o=function(e){throw e},a=function(e){if(this._state=n,this._callbacks=[],this._errbacks=[],"function"==typeof e){var t=this;e(function(e){f(t,e)},function(e){p(t,e)})}};a.prototype.then=function(e,t){var n={},i=this;return n.promise=new a(function(s,r){n.fulfill=s,n.reject=r,c(i,e,n),u(i,t,n)}),n.promise};var c=function(e,t,s){"function"!=typeof t&&(t=r);var o=function(e){h(t,e,s)};e._state===n?e._callbacks.push(o):e._state===i&&o(e._value)},u=function(e,t,i){"function"!=typeof t&&(t=o);var r=function(e){h(t,e,i)};e._state===n?e._errbacks.push(r):e._state===s&&r(e._reason)},h=function(t,n,i){e(function(){l(t,n,i)})},l=function(e,t,n){var i,s,o,a=!1;try{if(i=e(t),s=typeof i,o=null!==i&&("function"===s||"object"===s)&&i.then,i===n.promise)return n.reject(new TypeError("Recursive promise chain detected"));if("function"!=typeof o)return n.fulfill(i);o.call(i,function(e){a||(a=!0,l(r,e,n))},function(e){a||(a=!0,n.reject(e))})}catch(e){if(a)return;a=!0,n.reject(e)}},f=a.fulfill=a.resolve=function(e,t){if(e._state===n){e._state=i,e._value=t,e._errbacks=[];for(var s,r=e._callbacks;s=r.shift();)s(t)}},p=a.reject=function(e,t){if(e._state===n){e._state=s,e._reason=t,e._callbacks=[];for(var i,r=e._errbacks;i=r.shift();)i(t)}};a.defer=e,a.deferred=a.pending=function(){var e={};return e.promise=new a(function(t,n){e.fulfill=e.resolve=t,e.reject=n}),e},a.fulfilled=a.resolved=function(e){return new a(function(t,n){t(e)})},a.rejected=function(e){return new a(function(t,n){n(e)})},void 0===Faye?module.exports=a:Faye.Promise=a}(),Faye.Set=Faye.Class({initialize:function(){this._index={}},add:function(e){var t=void 0!==e.id?e.id:e;return!this._index.hasOwnProperty(t)&&(this._index[t]=e,!0)},forEach:function(e,t){for(var n in this._index)this._index.hasOwnProperty(n)&&e.call(t,this._index[n])},isEmpty:function(){for(var e in this._index)if(this._index.hasOwnProperty(e))return!1;return!0},member:function(e){for(var t in this._index)if(this._index[t]===e)return!0;return!1},remove:function(e){var t=void 0!==e.id?e.id:e,n=this._index[t];return delete this._index[t],n},toArray:function(){var e=[];return this.forEach(function(t){e.push(t)}),e}}),Faye.URI={isURI:function(e){return e&&e.protocol&&e.host&&e.path},isSameOrigin:function(e){var t=Faye.ENV.location;return e.protocol===t.protocol&&e.hostname===t.hostname&&e.port===t.port},parse:function(e){if("string"!=typeof e)return e;var t,n,i,s,r,o,a={},c=function(t,n){e=e.replace(n,function(e){return a[t]=e,""}),a[t]=a[t]||""};for(c("protocol",/^[a-z]+\:/i),c("host",/^\/\/[^\/\?#]+/),/^\//.test(e)||a.host||(e=Faye.ENV.location.pathname.replace(/[^\/]*$/,"")+e),c("pathname",/^[^\?#]*/),c("search",/^\?[^#]*/),c("hash",/^#.*/),a.protocol=a.protocol||Faye.ENV.location.protocol,a.host?(a.host=a.host.substr(2),t=a.host.split(":"),a.hostname=t[0],a.port=t[1]||""):(a.host=Faye.ENV.location.host,a.hostname=Faye.ENV.location.hostname,a.port=Faye.ENV.location.port),a.pathname=a.pathname||"/",a.path=a.pathname+a.search,n=a.search.replace(/^\?/,""),i=n?n.split("&"):[],o={},s=0,r=i.length;s<r;s++)t=i[s].split("="),o[decodeURIComponent(t[0]||"")]=decodeURIComponent(t[1]||"");return a.query=o,a.href=this.stringify(a),a},stringify:function(e){var t=e.protocol+"//"+e.hostname;return e.port&&(t+=":"+e.port),t+=e.pathname+this.queryString(e.query)+(e.hash||"")},queryString:function(e){var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return 0===t.length?"":"?"+t.join("&")}},Faye.Error=Faye.Class({initialize:function(e,t,n){this.code=e,this.params=Array.prototype.slice.call(t),this.message=n},toString:function(){return this.code+":"+this.params.join(",")+":"+this.message}}),Faye.Error.parse=function(e){if(e=e||"",!Faye.Grammar.ERROR.test(e))return new this(null,[],e);var t=e.split(":"),n=parseInt(t[0]),i=t[1].split(","),e=t[2];return new this(n,i,e)},Faye.Error.versionMismatch=function(){return""+new this(300,arguments,"Version mismatch")},Faye.Error.conntypeMismatch=function(){return""+new this(301,arguments,"Connection types not supported")},Faye.Error.extMismatch=function(){return""+new this(302,arguments,"Extension mismatch")},Faye.Error.badRequest=function(){return""+new this(400,arguments,"Bad request")},Faye.Error.clientUnknown=function(){return""+new this(401,arguments,"Unknown client")},Faye.Error.parameterMissing=function(){return""+new this(402,arguments,"Missing required parameter")},Faye.Error.channelForbidden=function(){return""+new this(403,arguments,"Forbidden channel")},Faye.Error.channelUnknown=function(){return""+new this(404,arguments,"Unknown channel")},Faye.Error.channelInvalid=function(){return""+new this(405,arguments,"Invalid channel")},Faye.Error.extUnknown=function(){return""+new this(406,arguments,"Unknown extension")},Faye.Error.publishFailed=function(){return""+new this(407,arguments,"Failed to publish")},Faye.Error.serverError=function(){return""+new this(500,arguments,"Internal server error")},Faye.Deferrable={then:function(e,t){var n=this;return this._promise||(this._promise=new Faye.Promise(function(e,t){n._fulfill=e,n._reject=t})),0===arguments.length?this._promise:this._promise.then(e,t)},callback:function(e,t){return this.then(function(n){e.call(t,n)})},errback:function(e,t){return this.then(null,function(n){e.call(t,n)})},timeout:function(e,t){this.then();var n=this;this._timer=Faye.ENV.setTimeout(function(){n._reject(t)},1e3*e)},setDeferredStatus:function(e,t){this._timer&&Faye.ENV.clearTimeout(this._timer);this.then();"succeeded"===e?this._fulfill(t):"failed"===e?this._reject(t):delete this._promise}},Faye.Publisher={countListeners:function(e){return this.listeners(e).length},bind:function(e,t,n){var i=Array.prototype.slice,s=function(){t.apply(n,i.call(arguments))};return this._listeners=this._listeners||[],this._listeners.push([e,t,n,s]),this.on(e,s)},unbind:function(e,t,n){this._listeners=this._listeners||[];for(var i,s=this._listeners.length;s--;)i=this._listeners[s],i[0]===e&&(!t||i[1]===t&&i[2]===n)&&(this._listeners.splice(s,1),this.removeListener(e,i[3]))}},Faye.extend(Faye.Publisher,Faye.EventEmitter.prototype),Faye.Publisher.trigger=Faye.Publisher.emit,Faye.Timeouts={addTimeout:function(e,t,n,i){if(this._timeouts=this._timeouts||{},!this._timeouts.hasOwnProperty(e)){var s=this;this._timeouts[e]=Faye.ENV.setTimeout(function(){delete s._timeouts[e],n.call(i)},1e3*t)}},removeTimeout:function(e){this._timeouts=this._timeouts||{};var t=this._timeouts[e];t&&(clearTimeout(t),delete this._timeouts[e])},removeAllTimeouts:function(){this._timeouts=this._timeouts||{};for(var e in this._timeouts)this.removeTimeout(e)}},Faye.Logging={LOG_LEVELS:{fatal:4,error:3,warn:2,info:1,debug:0},writeLog:function(e,t){if(Faye.logger){var e=Array.prototype.slice.apply(e),n="[Faye",i=this.className,s=e.shift().replace(/\?/g,function(){try{return Faye.toJSON(e.shift())}catch(e){return"[Object]"}});for(var r in Faye)i||"function"==typeof Faye[r]&&this instanceof Faye[r]&&(i=r);i&&(n+="."+i),n+="] ","function"==typeof Faye.logger[t]?Faye.logger[t](n+s):"function"==typeof Faye.logger&&Faye.logger(n+s)}}},function(){for(var e in Faye.Logging.LOG_LEVELS)!function(e,t){Faye.Logging[e]=function(){this.writeLog(arguments,e)}}(e,Faye.Logging.LOG_LEVELS[e])}(),Faye.Grammar={CHANNEL_NAME:/^\/(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)))+(\/(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)))+)*$/,CHANNEL_PATTERN:/^(\/(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)))+)*\/\*{1,2}$/,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])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*)$/,VERSION:/^([0-9])+(\.(([a-z]|[A-Z])|[0-9])(((([a-z]|[A-Z])|[0-9])|\-|\_))*)*$/},Faye.Extensible={addExtension:function(e){this._extensions=this._extensions||[],this._extensions.push(e),e.added&&e.added(this)},removeExtension:function(e){if(this._extensions)for(var t=this._extensions.length;t--;)this._extensions[t]===e&&(this._extensions.splice(t,1),e.removed&&e.removed(this))},pipeThroughExtensions:function(e,t,n,i,s){if(this.debug("Passing through ? extensions: ?",e,t),!this._extensions)return i.call(s,t);var r=this._extensions.slice(),o=function(t){if(!t)return i.call(s,t);var a=r.shift();if(!a)return i.call(s,t);var c=a[e];if(!c)return o(t);c.length>=3?a[e](t,n,o):a[e](t,o)};o(t)}},Faye.extend(Faye.Extensible,Faye.Logging),Faye.Channel=Faye.Class({initialize:function(e){this.id=this.name=e},push:function(e){this.trigger("message",e)},isUnused:function(){return 0===this.countListeners("message")}}),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(e){var t=this.parse(e),n=["/**",e],i=t.slice();i[i.length-1]="*",n.push(this.unparse(i));for(var s=1,r=t.length;s<r;s++)i=t.slice(0,s),i.push("**"),n.push(this.unparse(i));return n},isValid:function(e){return Faye.Grammar.CHANNEL_NAME.test(e)||Faye.Grammar.CHANNEL_PATTERN.test(e)},parse:function(e){return this.isValid(e)?e.split("/").slice(1):null},unparse:function(e){return"/"+e.join("/")},isMeta:function(e){var t=this.parse(e);return t?t[0]===this.META:null},isService:function(e){var t=this.parse(e);return t?t[0]===this.SERVICE:null},isSubscribable:function(e){return this.isValid(e)?!this.isMeta(e)&&!this.isService(e):null},Set:Faye.Class({initialize:function(){this._channels={}},getKeys:function(){var e=[];for(var t in this._channels)e.push(t);return e},remove:function(e){delete this._channels[e]},hasSubscription:function(e){return this._channels.hasOwnProperty(e)},subscribe:function(e,t,n){if(t)for(var i,s=0,r=e.length;s<r;s++){i=e[s];var o=this._channels[i]=this._channels[i]||new Faye.Channel(i);o.bind("message",t,n)}},unsubscribe:function(e,t,n){var i=this._channels[e];return!!i&&(i.unbind("message",t,n),!!i.isUnused()&&(this.remove(e),!0))},distributeMessage:function(e){for(var t=Faye.Channel.expand(e.channel),n=0,i=t.length;n<i;n++){var s=this._channels[t[n]];s&&s.trigger("message",e.data)}}})}),Faye.Envelope=Faye.Class({initialize:function(e,t){this.id=e.id,this.message=e,void 0!==t&&this.timeout(t/1e3,!1)}}),Faye.extend(Faye.Envelope.prototype,Faye.Deferrable),Faye.Publication=Faye.Class(Faye.Deferrable),Faye.Subscription=Faye.Class({initialize:function(e,t,n,i){this._client=e,this._channels=t,this._callback=n,this._context=i,this._cancelled=!1},cancel:function(){this._cancelled||(this._client.unsubscribe(this._channels,this._callback,this._context),this._cancelled=!0)},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,DEFAULT_RETRY:5,MAX_REQUEST_SIZE:2048,DEFAULT_ENDPOINT:"/bayeux",INTERVAL:0,initialize:function(e,t){this.info("New client created for ?",e),this._options=t||{},this.endpoint=Faye.URI.parse(e||this.DEFAULT_ENDPOINT),this.endpoints=this._options.endpoints||{},this.transports={},this.cookies=Faye.CookieJar&&new Faye.CookieJar,this.headers={},this.ca=this._options.ca,this._disabled=[],this._retry=this._options.retry||this.DEFAULT_RETRY;for(var n in this.endpoints)this.endpoints[n]=Faye.URI.parse(this.endpoints[n]);this.maxRequestSize=this.MAX_REQUEST_SIZE,this._state=this.UNCONNECTED,this._channels=new Faye.Channel.Set,this._messageId=0,this._responseCallbacks={},this._advice={reconnect:this.RETRY,interval:1e3*(this._options.interval||this.INTERVAL),timeout:1e3*(this._options.timeout||this.CONNECTION_TIMEOUT)},Faye.Event&&void 0!==Faye.ENV.onbeforeunload&&Faye.Event.on(Faye.ENV,"beforeunload",function(){Faye.indexOf(this._disabled,"autodisconnect")<0&&this.disconnect()},this)},disable:function(e){this._disabled.push(e)},setHeader:function(e,t){this.headers[e]=t},handshake:function(e,t){if(this._advice.reconnect!==this.NONE&&this._state===this.UNCONNECTED){this._state=this.CONNECTING;var n=this;this.info("Initiating handshake with ?",Faye.URI.stringify(this.endpoint)),this._selectTransport(Faye.MANDATORY_CONNECTION_TYPES),this._send({channel:Faye.Channel.HANDSHAKE,version:Faye.BAYEUX_VERSION,supportedConnectionTypes:[this._transport.connectionType]},function(i){i.successful?(this._state=this.CONNECTED,this._clientId=i.clientId,this._selectTransport(i.supportedConnectionTypes),this.info("Handshake successful: ?",this._clientId),this.subscribe(this._channels.getKeys(),!0),e&&Faye.Promise.defer(function(){e.call(t)})):(this.info("Handshake unsuccessful"),Faye.ENV.setTimeout(function(){n.handshake(e,t)},this._advice.interval),this._state=this.UNCONNECTED)},this)}},connect:function(e,t){if(this._advice.reconnect!==this.NONE&&this._state!==this.DISCONNECTED){if(this._state===this.UNCONNECTED)return this.handshake(function(){this.connect(e,t)},this);this.callback(e,t),this._state===this.CONNECTED&&(this.info("Calling deferred actions for ?",this._clientId),this.setDeferredStatus("succeeded"),this.setDeferredStatus("unknown"),this._connectRequest||(this._connectRequest=!0,this.info("Initiating connection for ?",this._clientId),this._send({channel:Faye.Channel.CONNECT,clientId:this._clientId,connectionType:this._transport.connectionType},this._cycleConnection,this)))}},disconnect:function(){this._state===this.CONNECTED&&(this._state=this.DISCONNECTED,this.info("Disconnecting ?",this._clientId),this._send({channel:Faye.Channel.DISCONNECT,clientId:this._clientId},function(e){e.successful&&(this._transport.close(),delete this._transport)},this),this.info("Clearing channel listeners for ?",this._clientId),this._channels=new Faye.Channel.Set)},subscribe:function(e,t,n){if(e instanceof Array)return Faye.map(e,function(e){return this.subscribe(e,t,n)},this);var i=new Faye.Subscription(this,e,t,n),s=!0===t;return this._channels.hasSubscription(e)&&!s?(this._channels.subscribe([e],t,n),i.setDeferredStatus("succeeded"),i):(this.connect(function(){this.info("Client ? attempting to subscribe to ?",this._clientId,e),s||this._channels.subscribe([e],t,n),this._send({channel:Faye.Channel.SUBSCRIBE,clientId:this._clientId,subscription:e},function(s){if(!s.successful)return i.setDeferredStatus("failed",Faye.Error.parse(s.error)),this._channels.unsubscribe(e,t,n);var r=[].concat(s.subscription);this.info("Subscription acknowledged for ? to ?",this._clientId,r),i.setDeferredStatus("succeeded")},this)},this),i)},unsubscribe:function(e,t,n){if(e instanceof Array)return Faye.map(e,function(e){return this.unsubscribe(e,t,n)},this);this._channels.unsubscribe(e,t,n)&&this.connect(function(){this.info("Client ? attempting to unsubscribe from ?",this._clientId,e),this._send({channel:Faye.Channel.UNSUBSCRIBE,clientId:this._clientId,subscription:e},function(e){if(e.successful){var t=[].concat(e.subscription);this.info("Unsubscription acknowledged for ? from ?",this._clientId,t)}},this)},this)},publish:function(e,t){var n=new Faye.Publication;return this.connect(function(){this.info("Client ? queueing published message to ?: ?",this._clientId,e,t),this._send({channel:e,data:t,clientId:this._clientId},function(e){e.successful?n.setDeferredStatus("succeeded"):n.setDeferredStatus("failed",Faye.Error.parse(e.error))},this)},this),n},receiveMessage:function(e){var t,n=e.id;void 0!==e.successful&&(t=this._responseCallbacks[n],delete this._responseCallbacks[n]),this.pipeThroughExtensions("incoming",e,null,function(e){e&&(e.advice&&this._handleAdvice(e.advice),this._deliverMessage(e),t&&t[0].call(t[1],e))},this),!0!==this._transportUp&&(this._transportUp=!0,this.trigger("transport:up"))},messageError:function(e,t){for(var n,i=this._retry,s=this,r=0,o=e.length;r<o;r++)n=e[r],n.id,t?this._transportSend(n):Faye.ENV.setTimeout(function(){s._transportSend(n)},1e3*i);t||!1===this._transportUp||(this._transportUp=!1,this.trigger("transport:down"))},_selectTransport:function(e){Faye.Transport.get(this,e,this._disabled,function(e){this.debug("Selected ? transport for ?",e.connectionType,Faye.URI.stringify(e.endpoint)),e!==this._transport&&(this._transport&&this._transport.close(),this._transport=e)},this)},_send:function(e,t,n){this._transport&&(e.id=e.id||this._generateMessageId(),this.pipeThroughExtensions("outgoing",e,null,function(e){e&&(t&&(this._responseCallbacks[e.id]=[t,n]),this._transportSend(e))},this))},_transportSend:function(e){if(this._transport){var t=1.2*(this._advice.timeout||1e3*this._retry),n=new Faye.Envelope(e,t);n.errback(function(t){this.messageError([e],t)},this),this._transport.send(n)}},_generateMessageId:function(){return this._messageId+=1,this._messageId>=Math.pow(2,32)&&(this._messageId=0),this._messageId.toString(36)},_handleAdvice:function(e){Faye.extend(this._advice,e),this._advice.reconnect===this.HANDSHAKE&&this._state!==this.DISCONNECTED&&(this._state=this.UNCONNECTED,this._clientId=null,this._cycleConnection())},_deliverMessage:function(e){e.channel&&void 0!==e.data&&(this.info("Client ? calling listeners for ? with ?",this._clientId,e.channel,e.data),this._channels.distributeMessage(e))},_cycleConnection:function(){this._connectRequest&&(this._connectRequest=null,this.info("Closed connection for ?",this._clientId));var e=this;Faye.ENV.setTimeout(function(){e.connect()},this._advice.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,batching:!0,initialize:function(e,t){this._client=e,this.endpoint=t,this._outbox=[]},close:function(){},encode:function(e){return""},send:function(e){var t=e.message;return this.debug("Client ? sending message to ?: ?",this._client._clientId,Faye.URI.stringify(this.endpoint),t),this.batching?(this._outbox.push(e),t.channel===Faye.Channel.HANDSHAKE?this.addTimeout("publish",.01,this.flush,this):(t.channel===Faye.Channel.CONNECT&&(this._connectMessage=t),this.flushLargeBatch(),void this.addTimeout("publish",this.MAX_DELAY,this.flush,this))):this.request([e])},flush:function(){this.removeTimeout("publish"),this._outbox.length>1&&this._connectMessage&&(this._connectMessage.advice={timeout:0}),this.request(this._outbox),this._connectMessage=null,this._outbox=[]},flushLargeBatch:function(){if(!(this.encode(this._outbox).length<this._client.maxRequestSize)){var e=this._outbox.pop();this.flush(),e&&this._outbox.push(e)}},receive:function(e,t){for(var n=e.length;n--;)e[n].setDeferredStatus("succeeded");t=[].concat(t),this.debug("Client ? received from ?: ?",this._client._clientId,Faye.URI.stringify(this.endpoint),t);for(var i=0,n=t.length;i<n;i++)this._client.receiveMessage(t[i])},handleError:function(e,t){for(var n=e.length;n--;)e[n].setDeferredStatus("failed",t)},_getCookies:function(){var e=this._client.cookies;return e?e.getCookies({domain:this.endpoint.hostname,path:this.endpoint.path,secure:"https:"===this.endpoint.protocol}).toValueString():""},_storeCookies:function(e){if(e&&this._client.cookies){e=[].concat(e);for(var t,n=0,i=e.length;n<i;n++)t=this._client.cookies.setCookie(e[n]),t=t[0]||t,t.domain=t.domain||this.endpoint.hostname}}}),{get:function(e,t,n,i,s){var r=e.endpoint;Faye.asyncEach(this._transports,function(o,a){var c=o[0],u=o[1],h=e.endpoints[c]||r;return Faye.indexOf(n,c)>=0?a():Faye.indexOf(t,c)<0?(u.isUsable(e,h,function(){}),a()):void u.isUsable(e,h,function(t){if(!t)return a();var n=u.hasOwnProperty("create")?u.create(e,h):new u(e,h);i.call(s,n)})},function(){throw Error("Could not find a usable connection type for "+Faye.URI.stringify(r))})},register:function(e,t){this._transports.push([e,t]),t.prototype.connectionType=e},_transports:[]}),Faye.extend(Faye.Transport.prototype,Faye.Logging),Faye.extend(Faye.Transport.prototype,Faye.Timeouts),Faye.Event={_registry:[],on:function(e,t,n,i){var s=function(){n.call(i)};e.addEventListener?e.addEventListener(t,s,!1):e.attachEvent("on"+t,s),this._registry.push({_element:e,_type:t,_callback:n,_context:i,_handler:s})},detach:function(e,t,n,i){for(var s,r=this._registry.length;r--;)s=this._registry[r],e&&e!==s._element||t&&t!==s._type||n&&n!==s._callback||i&&i!==s._context||(s._element.removeEventListener?s._element.removeEventListener(s._type,s._handler,!1):s._element.detachEvent("on"+s._type,s._handler),this._registry.splice(r,1),s=null)}},void 0!==Faye.ENV.onunload&&Faye.Event.on(Faye.ENV,"unload",Faye.Event.detach,Faye.Event),"object"!=typeof JSON&&(JSON={}),function(){function f(e){return e<10?"0"+e:e}function quote(e){return escapable.lastIndex=0,escapable.test(e)?'"'+e.replace(escapable,function(e){var t=meta[e];return"string"==typeof t?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'}function str(e,t){var n,i,s,r,o,a=gap,c=t[e];switch(c&&"object"==typeof c&&"function"==typeof c.toJSON&&(c=c.toJSON(e)),"function"==typeof rep&&(c=rep.call(t,e,c)),typeof c){case"string":return quote(c);case"number":return isFinite(c)?c+"":"null";case"boolean":case"null":return c+"";case"object":if(!c)return"null";if(gap+=indent,o=[],"[object Array]"===Object.prototype.toString.apply(c)){for(r=c.length,n=0;n<r;n+=1)o[n]=str(n,c)||"null";return s=0===o.length?"[]":gap?"[\n"+gap+o.join(",\n"+gap)+"\n"+a+"]":"["+o.join(",")+"]",gap=a,s}if(rep&&"object"==typeof rep)for(r=rep.length,n=0;n<r;n+=1)"string"==typeof rep[n]&&(i=rep[n],(s=str(i,c))&&o.push(quote(i)+(gap?": ":":")+s));else for(i in c)Object.prototype.hasOwnProperty.call(c,i)&&(s=str(i,c))&&o.push(quote(i)+(gap?": ":":")+s);return s=0===o.length?"{}":gap?"{\n"+gap+o.join(",\n"+gap)+"\n"+a+"}":"{"+o.join(",")+"}",gap=a,s}}"function"!=typeof Date.prototype.toJSON&&(Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null},String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(){return this.valueOf()});var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;Faye.stringify=function(e,t,n){var i;if(gap="",indent="","number"==typeof n)for(i=0;i<n;i+=1)indent+=" ";else"string"==typeof n&&(indent=n);if(rep=t,t&&"function"!=typeof t&&("object"!=typeof t||"number"!=typeof t.length))throw Error("JSON.stringify");return str("",{"":e})},"function"!=typeof JSON.stringify&&(JSON.stringify=Faye.stringify),"function"!=typeof JSON.parse&&(JSON.parse=function(text,reviver){function walk(e,t){var n,i,s=e[t];if(s&&"object"==typeof s)for(n in s)Object.prototype.hasOwnProperty.call(s,n)&&(i=walk(s,n),void 0!==i?s[n]=i:delete s[n]);return reviver.call(e,t,s)}var j;if(text+="",cx.lastIndex=0,cx.test(text)&&(text=text.replace(cx,function(e){return"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})),/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return j=eval("("+text+")"),"function"==typeof reviver?walk({"":j},""):j;throw new SyntaxError("JSON.parse")})}(),Faye.Transport.WebSocket=Faye.extend(Faye.Class(Faye.Transport,{UNCONNECTED:1,CONNECTING:2,CONNECTED:3,batching:!1,isUsable:function(e,t){this.callback(function(){e.call(t,!0)}),this.errback(function(){e.call(t,!1)}),this.connect()},request:function(e){this._pending=this._pending||new Faye.Set;for(var t=0,n=e.length;t<n;t++)this._pending.add(e[t]);this.callback(function(t){if(t){var n=Faye.map(e,function(e){return e.message});t.send(Faye.toJSON(n))}},this),this.connect()},connect:function(){if(!Faye.Transport.WebSocket._unloaded&&(this._state=this._state||this.UNCONNECTED,this._state===this.UNCONNECTED)){this._state=this.CONNECTING;var e=this._createSocket();if(!e)return this.setDeferredStatus("failed");var t=this;e.onopen=function(){e.headers&&t._storeCookies(e.headers["set-cookie"]),t._socket=e,t._state=t.CONNECTED,t._everConnected=!0,t._ping(),t.setDeferredStatus("succeeded",e)};var n=!1;e.onclose=e.onerror=function(){if(!n){n=!0;var i=t._state===t.CONNECTED;e.onopen=e.onclose=e.onerror=e.onmessage=null,delete t._socket,t._state=t.UNCONNECTED,t.removeTimeout("ping"),t.setDeferredStatus("unknown");var s=t._pending?t._pending.toArray():[];delete t._pending,i?t.handleError(s,!0):t._everConnected?t.handleError(s):t.setDeferredStatus("failed")}},e.onmessage=function(e){var n,i=JSON.parse(e.data),s=[];if(i){i=[].concat(i);for(var r=0,o=i.length;r<o;r++)void 0!==i[r].successful&&(n=t._pending.remove(i[r]))&&s.push(n);t.receive(s,i)}}}},close:function(){this._socket&&this._socket.close()},_createSocket:function(){var e=Faye.Transport.WebSocket.getSocketUrl(this.endpoint),t={headers:Faye.copyObject(this._client.headers),ca:this._client.ca};return t.headers.Cookie=this._getCookies(),Faye.WebSocket?new Faye.WebSocket.Client(e,[],t):Faye.ENV.MozWebSocket?new MozWebSocket(e):Faye.ENV.WebSocket?new WebSocket(e):void 0},_ping:function(){this._socket&&(this._socket.send("[]"),this.addTimeout("ping",this._client._advice.timeout/2e3,this._ping,this))}}),{PROTOCOLS:{"http:":"ws:","https:":"wss:"},create:function(e,t){var n=e.transports.websocket=e.transports.websocket||{};return n[t.href]=n[t.href]||new this(e,t),n[t.href]},getSocketUrl:function(e){return e=Faye.copyObject(e),e.protocol=this.PROTOCOLS[e.protocol],Faye.URI.stringify(e)},isUsable:function(e,t,n,i){this.create(e,t).isUsable(n,i)}}),Faye.extend(Faye.Transport.WebSocket.prototype,Faye.Deferrable),Faye.Transport.register("websocket",Faye.Transport.WebSocket),Faye.Event&&Faye.Event.on(Faye.ENV,"beforeunload",function(){Faye.Transport.WebSocket._unloaded=!0}),Faye.Transport.EventSource=Faye.extend(Faye.Class(Faye.Transport,{initialize:function(e,t){if(Faye.Transport.prototype.initialize.call(this,e,t),!Faye.ENV.EventSource)return this.setDeferredStatus("failed");this._xhr=new Faye.Transport.XHR(e,t),t=Faye.copyObject(t),t.pathname+="/"+e._clientId;var n=new EventSource(Faye.URI.stringify(t)),i=this;n.onopen=function(){i._everConnected=!0,i.setDeferredStatus("succeeded")},n.onerror=function(){i._everConnected?i._client.messageError([]):(i.setDeferredStatus("failed"),n.close())},n.onmessage=function(e){i.receive([],JSON.parse(e.data))},this._socket=n},close:function(){this._socket&&(this._socket.onopen=this._socket.onerror=this._socket.onmessage=null,this._socket.close(),delete this._socket)},isUsable:function(e,t){this.callback(function(){e.call(t,!0)}),this.errback(function(){e.call(t,!1)})},encode:function(e){return this._xhr.encode(e)},request:function(e){this._xhr.request(e)}}),{isUsable:function(e,t,n,i){if(!e._clientId)return n.call(i,!1);Faye.Transport.XHR.isUsable(e,t,function(s){if(!s)return n.call(i,!1);this.create(e,t).isUsable(n,i)},this)},create:function(e,t){var n=e.transports.eventsource=e.transports.eventsource||{},i=e._clientId;t=Faye.copyObject(t),t.pathname+="/"+(i||"");var s=Faye.URI.stringify(t);return n[s]=n[s]||new this(e,t),n[s]}}),Faye.extend(Faye.Transport.EventSource.prototype,Faye.Deferrable),Faye.Transport.register("eventsource",Faye.Transport.EventSource),Faye.Transport.XHR=Faye.extend(Faye.Class(Faye.Transport,{encode:function(e){var t=Faye.map(e,function(e){return e.message});return Faye.toJSON(t)},request:function(e){var t=this.endpoint.path,n=Faye.ENV.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest,i=this;n.open("POST",t,!0),n.setRequestHeader("Content-Type","application/json"),n.setRequestHeader("Pragma","no-cache"),n.setRequestHeader("X-Requested-With","XMLHttpRequest");var s=this._client.headers;for(var r in s)s.hasOwnProperty(r)&&n.setRequestHeader(r,s[r]);var o=function(){n.abort()};Faye.Event.on(Faye.ENV,"beforeunload",o),n.onreadystatechange=function(){if(n&&4===n.readyState){var t=null,s=n.status,r=n.responseText,a=s>=200&&s<300||304===s||1223===s;if(Faye.Event.detach(Faye.ENV,"beforeunload",o),n.onreadystatechange=function(){},n=null,!a)return i.handleError(e);try{t=JSON.parse(r)}catch(e){}t?i.receive(e,t):i.handleError(e)}},n.send(this.encode(e))}}),{isUsable:function(e,t,n,i){n.call(i,Faye.URI.isSameOrigin(t))}}),Faye.Transport.register("long-polling",Faye.Transport.XHR),Faye.Transport.CORS=Faye.extend(Faye.Class(Faye.Transport,{encode:function(e){var t=Faye.map(e,function(e){return e.message});return"message="+encodeURIComponent(Faye.toJSON(t))},request:function(e){var t,n=Faye.ENV.XDomainRequest?XDomainRequest:XMLHttpRequest,i=new n,s=this._client.headers,r=this;if(i.open("POST",Faye.URI.stringify(this.endpoint),!0),i.setRequestHeader){i.setRequestHeader("Pragma","no-cache");for(t in s)s.hasOwnProperty(t)&&i.setRequestHeader(t,s[t])}var o=function(){if(!i)return!1;i.onload=i.onerror=i.ontimeout=i.onprogress=null,i=null};i.onload=function(){var t=null;try{t=JSON.parse(i.responseText)}catch(e){}o(),t?r.receive(e,t):r.handleError(e)},i.onerror=i.ontimeout=function(){o(),r.handleError(e)},i.onprogress=function(){},i.send(this.encode(e))}}),{isUsable:function(e,t,n,i){if(Faye.URI.isSameOrigin(t))return n.call(i,!1);if(Faye.ENV.XDomainRequest)return n.call(i,t.protocol===Faye.ENV.location.protocol);if(Faye.ENV.XMLHttpRequest){var s=new Faye.ENV.XMLHttpRequest;return n.call(i,void 0!==s.withCredentials)}return n.call(i,!1)}}),Faye.Transport.register("cross-origin-long-polling",Faye.Transport.CORS),Faye.Transport.JSONP=Faye.extend(Faye.Class(Faye.Transport,{encode:function(e){var t=Faye.map(e,function(e){return e.message}),n=Faye.copyObject(this.endpoint);return n.query.message=Faye.toJSON(t),n.query.jsonp="__jsonp"+Faye.Transport.JSONP._cbCount+"__",Faye.URI.stringify(n)},request:function(e){var t=Faye.map(e,function(e){return e.message}),n=document.getElementsByTagName("head")[0],i=document.createElement("script"),s=Faye.Transport.JSONP.getCallbackName(),r=Faye.copyObject(this.endpoint),o=this;r.query.message=Faye.toJSON(t),r.query.jsonp=s,Faye.ENV[s]=function(t){if(!Faye.ENV[s])return!1;Faye.ENV[s]=void 0;try{delete Faye.ENV[s]}catch(e){}i.parentNode.removeChild(i),o.receive(e,t)},i.type="text/javascript",i.src=Faye.URI.stringify(r),n.appendChild(i)}}),{_cbCount:0,getCallbackName:function(){return this._cbCount+=1,"__jsonp"+this._cbCount+"__"},isUsable:function(e,t,n,i){n.call(i,!0)}}),Faye.Transport.register("callback-polling",Faye.Transport.JSONP)}();
|
1
|
+
!function(){"use strict";var Faye={VERSION:"1.1.0",BAYEUX_VERSION:"1.0",ID_LENGTH:160,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:"undefined"!=typeof window?window:global,extend:function(e,t,n){if(!t)return e;for(var i in t)t.hasOwnProperty(i)&&(e.hasOwnProperty(i)&&n===!1||e[i]!==t[i]&&(e[i]=t[i]));return e},random:function(e){e=e||this.ID_LENGTH;for(var t=Math.ceil(e*Math.log(2)/Math.log(36)),n=csprng(e,36);n.length<t;)n="0"+n;return n},validateOptions:function(e,t){for(var n in e)if(this.indexOf(t,n)<0)throw Error("Unrecognized option: "+n)},clientIdFromMessages:function(e){var t=this.filter([].concat(e),function(e){return"/meta/connect"===e.channel});return t[0]&&t[0].clientId},copyObject:function(e){var t,n,i;if(e instanceof Array){for(t=[],n=e.length;n--;)t[n]=Faye.copyObject(e[n]);return t}if("object"==typeof e){t=null===e?null:{};for(i in e)t[i]=Faye.copyObject(e[i]);return t}return e},commonElement:function(e,t){for(var n=0,i=e.length;i>n;n++)if(-1!==this.indexOf(t,e[n]))return e[n];return null},indexOf:function(e,t){if(e.indexOf)return e.indexOf(t);for(var n=0,i=e.length;i>n;n++)if(e[n]===t)return n;return-1},map:function(e,t,n){if(e.map)return e.map(t,n);var i=[];if(e instanceof Array)for(var s=0,r=e.length;r>s;s++)i.push(t.call(n||null,e[s],s));else for(var o in e)e.hasOwnProperty(o)&&i.push(t.call(n||null,o,e[o]));return i},filter:function(e,t,n){if(e.filter)return e.filter(t,n);for(var i=[],s=0,r=e.length;r>s;s++)t.call(n||null,e[s],s)&&i.push(e[s]);return i},asyncEach:function(e,t,n,i){var s=e.length,r=-1,o=0,a=!1,c=function(){return o-=1,r+=1,r===s?n&&n.call(i):void t(e[r],u)},h=function(){if(!a){for(a=!0;o>0;)c();a=!1}},u=function(){o+=1,h()};u()},toJSON:function(e){return this.stringify?this.stringify(e,function(e,t){return this[e]instanceof Array?this[e]:t}):JSON.stringify(e)}};"undefined"!=typeof module?module.exports=Faye:"undefined"!=typeof window&&(window.Faye=Faye),Faye.Class=function(e,t){"function"!=typeof e&&(t=e,e=Object);var n=function(){return this.initialize?this.initialize.apply(this,arguments)||this:this},i=function(){};return i.prototype=e.prototype,n.prototype=new i,Faye.extend(n.prototype,t),n},function(){function e(e,t){if(e.indexOf)return e.indexOf(t);for(var n=0;n<e.length;n++)if(t===e[n])return n;return-1}var t=Faye.EventEmitter=function(){},n="function"==typeof Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)};t.prototype.emit=function(e){if("error"===e&&(!this._events||!this._events.error||n(this._events.error)&&!this._events.error.length))throw arguments[1]instanceof Error?arguments[1]:Error("Uncaught, unspecified 'error' event.");if(!this._events)return!1;var t=this._events[e];if(!t)return!1;if("function"==typeof t){switch(arguments.length){case 1:t.call(this);break;case 2:t.call(this,arguments[1]);break;case 3:t.call(this,arguments[1],arguments[2]);break;default:var i=Array.prototype.slice.call(arguments,1);t.apply(this,i)}return!0}if(n(t)){for(var i=Array.prototype.slice.call(arguments,1),s=t.slice(),r=0,o=s.length;o>r;r++)s[r].apply(this,i);return!0}return!1},t.prototype.addListener=function(e,t){if("function"!=typeof t)throw Error("addListener only takes instances of Function");return this._events||(this._events={}),this.emit("newListener",e,t),this._events[e]?n(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,this},t.prototype.on=t.prototype.addListener,t.prototype.once=function(e,t){var n=this;return n.on(e,function i(){n.removeListener(e,i),t.apply(this,arguments)}),this},t.prototype.removeListener=function(t,i){if("function"!=typeof i)throw Error("removeListener only takes instances of Function");if(!this._events||!this._events[t])return this;var s=this._events[t];if(n(s)){var r=e(s,i);if(0>r)return this;s.splice(r,1),0==s.length&&delete this._events[t]}else this._events[t]===i&&delete this._events[t];return this},t.prototype.removeAllListeners=function(e){return 0===arguments.length?(this._events={},this):(e&&this._events&&this._events[e]&&(this._events[e]=null),this)},t.prototype.listeners=function(e){return this._events||(this._events={}),this._events[e]||(this._events[e]=[]),n(this._events[e])||(this._events[e]=[this._events[e]]),this._events[e]}}(),Faye.Namespace=Faye.Class({initialize:function(){this._used={}},exists:function(e){return this._used.hasOwnProperty(e)},generate:function(){for(var e=Faye.random();this._used.hasOwnProperty(e);)e=Faye.random();return this._used[e]=e},release:function(e){delete this._used[e]}}),function(){var e,t=setTimeout;e="function"==typeof setImmediate?function(e){setImmediate(e)}:"object"==typeof process&&process.nextTick?function(e){process.nextTick(e)}:function(e){t(e,0)};var n=0,i=1,s=2,r=function(e){return e},o=function(e){throw e},a=function(e){if(this._state=n,this._onFulfilled=[],this._onRejected=[],"function"==typeof e){var t=this;e(function(e){f(t,e)},function(e){d(t,e)})}};a.prototype.then=function(e,t){var n=new a;return c(this,e,n),h(this,t,n),n};var c=function(e,t,s){"function"!=typeof t&&(t=r);var o=function(e){u(t,e,s)};e._state===n?e._onFulfilled.push(o):e._state===i&&o(e._value)},h=function(e,t,i){"function"!=typeof t&&(t=o);var r=function(e){u(t,e,i)};e._state===n?e._onRejected.push(r):e._state===s&&r(e._reason)},u=function(t,n,i){e(function(){l(t,n,i)})},l=function(e,t,n){var i;try{i=e(t)}catch(s){return d(n,s)}i===n?d(n,new TypeError("Recursive promise chain detected")):f(n,i)},f=a.fulfill=a.resolve=function(e,t){var n,i,s=!1;try{if(n=typeof t,i=null!==t&&("function"===n||"object"===n)&&t.then,"function"!=typeof i)return p(e,t);i.call(t,function(t){s^(s=!0)&&f(e,t)},function(t){s^(s=!0)&&d(e,t)})}catch(r){if(!(s^(s=!0)))return;d(e,r)}},p=function(e,t){if(e._state===n){e._state=i,e._value=t,e._onRejected=[];for(var s,r=e._onFulfilled;s=r.shift();)s(t)}},d=a.reject=function(e,t){if(e._state===n){e._state=s,e._reason=t,e._onFulfilled=[];for(var i,r=e._onRejected;i=r.shift();)i(t)}};a.all=function(e){return new a(function(t,n){var i,s=[],r=e.length;if(0===r)return t(s);for(i=0;r>i;i++)(function(e,i){a.fulfilled(e).then(function(e){s[i]=e,0===--r&&t(s)},n)})(e[i],i)})},a.defer=e,a.deferred=a.pending=function(){var e={};return e.promise=new a(function(t,n){e.fulfill=e.resolve=t,e.reject=n}),e},a.fulfilled=a.resolved=function(e){return new a(function(t){t(e)})},a.rejected=function(e){return new a(function(t,n){n(e)})},void 0===Faye?module.exports=a:Faye.Promise=a}(),Faye.Set=Faye.Class({initialize:function(){this._index={}},add:function(e){var t=void 0!==e.id?e.id:e;return this._index.hasOwnProperty(t)?!1:(this._index[t]=e,!0)},forEach:function(e,t){for(var n in this._index)this._index.hasOwnProperty(n)&&e.call(t,this._index[n])},isEmpty:function(){for(var e in this._index)if(this._index.hasOwnProperty(e))return!1;return!0},member:function(e){for(var t in this._index)if(this._index[t]===e)return!0;return!1},remove:function(e){var t=void 0!==e.id?e.id:e,n=this._index[t];return delete this._index[t],n},toArray:function(){var e=[];return this.forEach(function(t){e.push(t)}),e}}),Faye.URI={isURI:function(e){return e&&e.protocol&&e.host&&e.path},isSameOrigin:function(e){var t=Faye.ENV.location;return e.protocol===t.protocol&&e.hostname===t.hostname&&e.port===t.port},parse:function(e){if("string"!=typeof e)return e;var t,n,i,s,r,o,a={},c=function(t,n){e=e.replace(n,function(e){return a[t]=e,""}),a[t]=a[t]||""};for(c("protocol",/^[a-z]+\:/i),c("host",/^\/\/[^\/\?#]+/),/^\//.test(e)||a.host||(e=Faye.ENV.location.pathname.replace(/[^\/]*$/,"")+e),c("pathname",/^[^\?#]*/),c("search",/^\?[^#]*/),c("hash",/^#.*/),a.protocol=a.protocol||Faye.ENV.location.protocol,a.host?(a.host=a.host.substr(2),t=a.host.split(":"),a.hostname=t[0],a.port=t[1]||""):(a.host=Faye.ENV.location.host,a.hostname=Faye.ENV.location.hostname,a.port=Faye.ENV.location.port),a.pathname=a.pathname||"/",a.path=a.pathname+a.search,n=a.search.replace(/^\?/,""),i=n?n.split("&"):[],o={},s=0,r=i.length;r>s;s++)t=i[s].split("="),o[decodeURIComponent(t[0]||"")]=decodeURIComponent(t[1]||"");return a.query=o,a.href=this.stringify(a),a},stringify:function(e){var t=e.protocol+"//"+e.hostname;return e.port&&(t+=":"+e.port),t+=e.pathname+this.queryString(e.query)+(e.hash||"")},queryString:function(e){var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return 0===t.length?"":"?"+t.join("&")}},Faye.Error=Faye.Class({initialize:function(e,t,n){this.code=e,this.params=Array.prototype.slice.call(t),this.message=n},toString:function(){return this.code+":"+this.params.join(",")+":"+this.message}}),Faye.Error.parse=function(e){if(e=e||"",!Faye.Grammar.ERROR.test(e))return new this(null,[],e);var t=e.split(":"),n=parseInt(t[0]),i=t[1].split(","),e=t[2];return new this(n,i,e)},Faye.Error.versionMismatch=function(){return""+new this(300,arguments,"Version mismatch")},Faye.Error.conntypeMismatch=function(){return""+new this(301,arguments,"Connection types not supported")},Faye.Error.extMismatch=function(){return""+new this(302,arguments,"Extension mismatch")},Faye.Error.badRequest=function(){return""+new this(400,arguments,"Bad request")},Faye.Error.clientUnknown=function(){return""+new this(401,arguments,"Unknown client")},Faye.Error.parameterMissing=function(){return""+new this(402,arguments,"Missing required parameter")},Faye.Error.channelForbidden=function(){return""+new this(403,arguments,"Forbidden channel")},Faye.Error.channelUnknown=function(){return""+new this(404,arguments,"Unknown channel")},Faye.Error.channelInvalid=function(){return""+new this(405,arguments,"Invalid channel")},Faye.Error.extUnknown=function(){return""+new this(406,arguments,"Unknown extension")},Faye.Error.publishFailed=function(){return""+new this(407,arguments,"Failed to publish")},Faye.Error.serverError=function(){return""+new this(500,arguments,"Internal server error")},Faye.Deferrable={then:function(e,t){var n=this;return this._promise||(this._promise=new Faye.Promise(function(e,t){n._fulfill=e,n._reject=t})),0===arguments.length?this._promise:this._promise.then(e,t)},callback:function(e,t){return this.then(function(n){e.call(t,n)})},errback:function(e,t){return this.then(null,function(n){e.call(t,n)})},timeout:function(e,t){this.then();var n=this;this._timer=Faye.ENV.setTimeout(function(){n._reject(t)},1e3*e)},setDeferredStatus:function(e,t){this._timer&&Faye.ENV.clearTimeout(this._timer),this.then(),"succeeded"===e?this._fulfill(t):"failed"===e?this._reject(t):delete this._promise}},Faye.Publisher={countListeners:function(e){return this.listeners(e).length},bind:function(e,t,n){var i=Array.prototype.slice,s=function(){t.apply(n,i.call(arguments))};return this._listeners=this._listeners||[],this._listeners.push([e,t,n,s]),this.on(e,s)},unbind:function(e,t,n){this._listeners=this._listeners||[];for(var i,s=this._listeners.length;s--;)i=this._listeners[s],i[0]===e&&(!t||i[1]===t&&i[2]===n)&&(this._listeners.splice(s,1),this.removeListener(e,i[3]))}},Faye.extend(Faye.Publisher,Faye.EventEmitter.prototype),Faye.Publisher.trigger=Faye.Publisher.emit,Faye.Timeouts={addTimeout:function(e,t,n,i){if(this._timeouts=this._timeouts||{},!this._timeouts.hasOwnProperty(e)){var s=this;this._timeouts[e]=Faye.ENV.setTimeout(function(){delete s._timeouts[e],n.call(i)},1e3*t)}},removeTimeout:function(e){this._timeouts=this._timeouts||{};var t=this._timeouts[e];t&&(Faye.ENV.clearTimeout(t),delete this._timeouts[e])},removeAllTimeouts:function(){this._timeouts=this._timeouts||{};for(var e in this._timeouts)this.removeTimeout(e)}},Faye.Logging={LOG_LEVELS:{fatal:4,error:3,warn:2,info:1,debug:0},writeLog:function(e,t){if(Faye.logger){var n=Array.prototype.slice.apply(e),i="[Faye",s=this.className,r=n.shift().replace(/\?/g,function(){try{return Faye.toJSON(n.shift())}catch(e){return"[Object]"}});for(var o in Faye)s||"function"==typeof Faye[o]&&this instanceof Faye[o]&&(s=o);s&&(i+="."+s),i+="] ","function"==typeof Faye.logger[t]?Faye.logger[t](i+r):"function"==typeof Faye.logger&&Faye.logger(i+r)}}},function(){for(var e in Faye.Logging.LOG_LEVELS)(function(e){Faye.Logging[e]=function(){this.writeLog(arguments,e)}})(e)}(),Faye.Grammar={CHANNEL_NAME:/^\/(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)))+(\/(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)))+)*$/,CHANNEL_PATTERN:/^(\/(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)))+)*\/\*{1,2}$/,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])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*)$/,VERSION:/^([0-9])+(\.(([a-z]|[A-Z])|[0-9])(((([a-z]|[A-Z])|[0-9])|\-|\_))*)*$/},Faye.Extensible={addExtension:function(e){this._extensions=this._extensions||[],this._extensions.push(e),e.added&&e.added(this)},removeExtension:function(e){if(this._extensions)for(var t=this._extensions.length;t--;)this._extensions[t]===e&&(this._extensions.splice(t,1),e.removed&&e.removed(this))},pipeThroughExtensions:function(e,t,n,i,s){if(this.debug("Passing through ? extensions: ?",e,t),!this._extensions)return i.call(s,t);var r=this._extensions.slice(),o=function(t){if(!t)return i.call(s,t);var a=r.shift();if(!a)return i.call(s,t);var c=a[e];return c?void(c.length>=3?a[e](t,n,o):a[e](t,o)):o(t)};o(t)}},Faye.extend(Faye.Extensible,Faye.Logging),Faye.Channel=Faye.Class({initialize:function(e){this.id=this.name=e},push:function(e){this.trigger("message",e)},isUnused:function(){return 0===this.countListeners("message")}}),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(e){var t=this.parse(e),n=["/**",e],i=t.slice();i[i.length-1]="*",n.push(this.unparse(i));for(var s=1,r=t.length;r>s;s++)i=t.slice(0,s),i.push("**"),n.push(this.unparse(i));return n},isValid:function(e){return Faye.Grammar.CHANNEL_NAME.test(e)||Faye.Grammar.CHANNEL_PATTERN.test(e)},parse:function(e){return this.isValid(e)?e.split("/").slice(1):null},unparse:function(e){return"/"+e.join("/")},isMeta:function(e){var t=this.parse(e);return t?t[0]===this.META:null},isService:function(e){var t=this.parse(e);return t?t[0]===this.SERVICE:null},isSubscribable:function(e){return this.isValid(e)?!this.isMeta(e)&&!this.isService(e):null},Set:Faye.Class({initialize:function(){this._channels={}},getKeys:function(){var e=[];for(var t in this._channels)e.push(t);return e},remove:function(e){delete this._channels[e]},hasSubscription:function(e){return this._channels.hasOwnProperty(e)},subscribe:function(e,t,n){for(var i,s=0,r=e.length;r>s;s++){i=e[s];var o=this._channels[i]=this._channels[i]||new Faye.Channel(i);t&&o.bind("message",t,n)}},unsubscribe:function(e,t,n){var i=this._channels[e];return i?(i.unbind("message",t,n),i.isUnused()?(this.remove(e),!0):!1):!1},distributeMessage:function(e){for(var t=Faye.Channel.expand(e.channel),n=0,i=t.length;i>n;n++){var s=this._channels[t[n]];s&&s.trigger("message",e.data)}}})}),Faye.Publication=Faye.Class(Faye.Deferrable),Faye.Subscription=Faye.Class({initialize:function(e,t,n,i){this._client=e,this._channels=t,this._callback=n,this._context=i,this._cancelled=!1},cancel:function(){this._cancelled||(this._client.unsubscribe(this._channels,this._callback,this._context),this._cancelled=!0)},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,DEFAULT_ENDPOINT:"/bayeux",INTERVAL:0,initialize:function(e,t){this.info("New client created for ?",e),t=t||{},Faye.validateOptions(t,["interval","timeout","endpoints","proxy","retry","scheduler","websocketExtensions","tls","ca"]),this._endpoint=e||this.DEFAULT_ENDPOINT,this._channels=new Faye.Channel.Set,this._dispatcher=new Faye.Dispatcher(this,this._endpoint,t),this._messageId=0,this._state=this.UNCONNECTED,this._responseCallbacks={},this._advice={reconnect:this.RETRY,interval:1e3*(t.interval||this.INTERVAL),timeout:1e3*(t.timeout||this.CONNECTION_TIMEOUT)},this._dispatcher.timeout=this._advice.timeout/1e3,this._dispatcher.bind("message",this._receiveMessage,this),Faye.Event&&void 0!==Faye.ENV.onbeforeunload&&Faye.Event.on(Faye.ENV,"beforeunload",function(){Faye.indexOf(this._dispatcher._disabled,"autodisconnect")<0&&this.disconnect()},this)},addWebsocketExtension:function(e){return this._dispatcher.addWebsocketExtension(e)},disable:function(e){return this._dispatcher.disable(e)},setHeader:function(e,t){return this._dispatcher.setHeader(e,t)},handshake:function(e,t){if(this._advice.reconnect!==this.NONE&&this._state===this.UNCONNECTED){this._state=this.CONNECTING;var n=this;this.info("Initiating handshake with ?",Faye.URI.stringify(this._endpoint)),this._dispatcher.selectTransport(Faye.MANDATORY_CONNECTION_TYPES),this._sendMessage({channel:Faye.Channel.HANDSHAKE,version:Faye.BAYEUX_VERSION,supportedConnectionTypes:this._dispatcher.getConnectionTypes()},{},function(i){i.successful?(this._state=this.CONNECTED,this._dispatcher.clientId=i.clientId,this._dispatcher.selectTransport(i.supportedConnectionTypes),this.info("Handshake successful: ?",this._dispatcher.clientId),this.subscribe(this._channels.getKeys(),!0),e&&Faye.Promise.defer(function(){e.call(t)})):(this.info("Handshake unsuccessful"),Faye.ENV.setTimeout(function(){n.handshake(e,t)},1e3*this._dispatcher.retry),this._state=this.UNCONNECTED)},this)}},connect:function(e,t){if(this._advice.reconnect!==this.NONE&&this._state!==this.DISCONNECTED){if(this._state===this.UNCONNECTED)return this.handshake(function(){this.connect(e,t)},this);this.callback(e,t),this._state===this.CONNECTED&&(this.info("Calling deferred actions for ?",this._dispatcher.clientId),this.setDeferredStatus("succeeded"),this.setDeferredStatus("unknown"),this._connectRequest||(this._connectRequest=!0,this.info("Initiating connection for ?",this._dispatcher.clientId),this._sendMessage({channel:Faye.Channel.CONNECT,clientId:this._dispatcher.clientId,connectionType:this._dispatcher.connectionType},{},this._cycleConnection,this)))}},disconnect:function(){if(this._state===this.CONNECTED){this._state=this.DISCONNECTED,this.info("Disconnecting ?",this._dispatcher.clientId);var e=new Faye.Publication;return this._sendMessage({channel:Faye.Channel.DISCONNECT,clientId:this._dispatcher.clientId},{},function(t){t.successful?(this._dispatcher.close(),e.setDeferredStatus("succeeded")):e.setDeferredStatus("failed",Faye.Error.parse(t.error))},this),this.info("Clearing channel listeners for ?",this._dispatcher.clientId),this._channels=new Faye.Channel.Set,e}},subscribe:function(e,t,n){if(e instanceof Array)return Faye.map(e,function(e){return this.subscribe(e,t,n)},this);var i=new Faye.Subscription(this,e,t,n),s=t===!0,r=this._channels.hasSubscription(e);return r&&!s?(this._channels.subscribe([e],t,n),i.setDeferredStatus("succeeded"),i):(this.connect(function(){this.info("Client ? attempting to subscribe to ?",this._dispatcher.clientId,e),s||this._channels.subscribe([e],t,n),this._sendMessage({channel:Faye.Channel.SUBSCRIBE,clientId:this._dispatcher.clientId,subscription:e},{},function(s){if(!s.successful)return i.setDeferredStatus("failed",Faye.Error.parse(s.error)),this._channels.unsubscribe(e,t,n);var r=[].concat(s.subscription);this.info("Subscription acknowledged for ? to ?",this._dispatcher.clientId,r),i.setDeferredStatus("succeeded")},this)},this),i)},unsubscribe:function(e,t,n){if(e instanceof Array)return Faye.map(e,function(e){return this.unsubscribe(e,t,n)},this);var i=this._channels.unsubscribe(e,t,n);i&&this.connect(function(){this.info("Client ? attempting to unsubscribe from ?",this._dispatcher.clientId,e),this._sendMessage({channel:Faye.Channel.UNSUBSCRIBE,clientId:this._dispatcher.clientId,subscription:e},{},function(e){if(e.successful){var t=[].concat(e.subscription);this.info("Unsubscription acknowledged for ? from ?",this._dispatcher.clientId,t)}},this)},this)},publish:function(e,t,n){Faye.validateOptions(n||{},["attempts","deadline"]);var i=new Faye.Publication;return this.connect(function(){this.info("Client ? queueing published message to ?: ?",this._dispatcher.clientId,e,t),this._sendMessage({channel:e,data:t,clientId:this._dispatcher.clientId},n,function(e){e.successful?i.setDeferredStatus("succeeded"):i.setDeferredStatus("failed",Faye.Error.parse(e.error))},this)},this),i},_sendMessage:function(e,t,n,i){e.id=this._generateMessageId();var s=this._advice.timeout?1.2*this._advice.timeout/1e3:1.2*this._dispatcher.retry;this.pipeThroughExtensions("outgoing",e,null,function(e){e&&(n&&(this._responseCallbacks[e.id]=[n,i]),this._dispatcher.sendMessage(e,s,t||{}))},this)},_generateMessageId:function(){return this._messageId+=1,this._messageId>=Math.pow(2,32)&&(this._messageId=0),this._messageId.toString(36)},_receiveMessage:function(e){var t,n=e.id;void 0!==e.successful&&(t=this._responseCallbacks[n],delete this._responseCallbacks[n]),this.pipeThroughExtensions("incoming",e,null,function(e){e&&(e.advice&&this._handleAdvice(e.advice),this._deliverMessage(e),t&&t[0].call(t[1],e))},this)},_handleAdvice:function(e){Faye.extend(this._advice,e),this._dispatcher.timeout=this._advice.timeout/1e3,this._advice.reconnect===this.HANDSHAKE&&this._state!==this.DISCONNECTED&&(this._state=this.UNCONNECTED,this._dispatcher.clientId=null,this._cycleConnection())},_deliverMessage:function(e){e.channel&&void 0!==e.data&&(this.info("Client ? calling listeners for ? with ?",this._dispatcher.clientId,e.channel,e.data),this._channels.distributeMessage(e))},_cycleConnection:function(){this._connectRequest&&(this._connectRequest=null,this.info("Closed connection for ?",this._dispatcher.clientId));var e=this;Faye.ENV.setTimeout(function(){e.connect()},this._advice.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.Dispatcher=Faye.Class({MAX_REQUEST_SIZE:2048,DEFAULT_RETRY:5,UP:1,DOWN:2,initialize:function(e,t,n){this._client=e,this.endpoint=Faye.URI.parse(t),this._alternates=n.endpoints||{},this.cookies=Faye.Cookies&&new Faye.Cookies.CookieJar,this._disabled=[],this._envelopes={},this.headers={},this.retry=n.retry||this.DEFAULT_RETRY,this._scheduler=n.scheduler||Faye.Scheduler,this._state=0,this.transports={},this.wsExtensions=[],this.proxy=n.proxy||{},"string"==typeof this._proxy&&(this._proxy={origin:this._proxy});var i=n.websocketExtensions;if(i){i=[].concat(i);for(var s=0,r=i.length;r>s;s++)this.addWebsocketExtension(i[s])}this.tls=n.tls||{},this.tls.ca=this.tls.ca||n.ca;for(var o in this._alternates)this._alternates[o]=Faye.URI.parse(this._alternates[o]);this.maxRequestSize=this.MAX_REQUEST_SIZE},endpointFor:function(e){return this._alternates[e]||this.endpoint},addWebsocketExtension:function(e){this.wsExtensions.push(e)},disable:function(e){this._disabled.push(e)},setHeader:function(e,t){this.headers[e]=t},close:function(){var e=this._transport;delete this._transport,e&&e.close()},getConnectionTypes:function(){return Faye.Transport.getConnectionTypes()},selectTransport:function(e){Faye.Transport.get(this,e,this._disabled,function(e){this.debug("Selected ? transport for ?",e.connectionType,Faye.URI.stringify(e.endpoint)),e!==this._transport&&(this._transport&&this._transport.close(),this._transport=e,this.connectionType=e.connectionType)},this)},sendMessage:function(e,t,n){if(this._transport){n=n||{};var i,s=e.id,r=n.attempts,o=n.deadline&&(new Date).getTime()+1e3*n.deadline,a=this._envelopes[s];a||(i=new this._scheduler(e,{timeout:t,interval:this.retry,attempts:r,deadline:o}),a=this._envelopes[s]={message:e,scheduler:i}),this._sendEnvelope(a)}},_sendEnvelope:function(e){if(!e.request&&!e.timer){var t=e.message,n=e.scheduler,i=this;if(!n.isDeliverable())return n.abort(),void delete this._envelopes[t.id];e.timer=Faye.ENV.setTimeout(function(){i.handleError(t)},1e3*n.getTimeout()),n.send(),e.request=this._transport.sendMessage(t)}},handleResponse:function(e){var t=this._envelopes[e.id];void 0!==e.successful&&t&&(t.scheduler.succeed(),delete this._envelopes[e.id],Faye.ENV.clearTimeout(t.timer)),this.trigger("message",e),this._state!==this.UP&&(this._state=this.UP,this._client.trigger("transport:up"))},handleError:function(e,t){var n=this._envelopes[e.id],i=n&&n.request,s=this;if(i){i.then(function(e){e&&e.abort&&e.abort()});var r=n.scheduler;r.fail(),Faye.ENV.clearTimeout(n.timer),n.request=n.timer=null,t?this._sendEnvelope(n):n.timer=Faye.ENV.setTimeout(function(){n.timer=null,s._sendEnvelope(n)},1e3*r.getInterval()),this._state!==this.DOWN&&(this._state=this.DOWN,this._client.trigger("transport:down"))}}}),Faye.extend(Faye.Dispatcher.prototype,Faye.Publisher),Faye.extend(Faye.Dispatcher.prototype,Faye.Logging),Faye.Scheduler=function(e,t){this.message=e,this.options=t,this.attempts=0},Faye.extend(Faye.Scheduler.prototype,{getTimeout:function(){return this.options.timeout},getInterval:function(){return this.options.interval},isDeliverable:function(){var e=this.options.attempts,t=this.attempts,n=this.options.deadline,i=(new Date).getTime();return void 0!==e&&t>=e?!1:void 0!==n&&i>n?!1:!0},send:function(){this.attempts+=1},succeed:function(){},fail:function(){},abort:function(){}}),Faye.Transport=Faye.extend(Faye.Class({DEFAULT_PORTS:{"http:":80,"https:":443,"ws:":80,"wss:":443},SECURE_PROTOCOLS:["https:","wss:"],MAX_DELAY:0,batching:!0,initialize:function(e,t){this._dispatcher=e,this.endpoint=t,this._outbox=[],this._proxy=Faye.extend({},this._dispatcher.proxy),!this._proxy.origin&&Faye.NodeAdapter&&(this._proxy.origin=Faye.indexOf(this.SECURE_PROTOCOLS,this.endpoint.protocol)>=0?process.env.HTTPS_PROXY||process.env.https_proxy:process.env.HTTP_PROXY||process.env.http_proxy)},close:function(){},encode:function(){return""},sendMessage:function(e){return this.debug("Client ? sending message to ?: ?",this._dispatcher.clientId,Faye.URI.stringify(this.endpoint),e),this.batching?(this._outbox.push(e),this._flushLargeBatch(),this._promise=this._promise||new Faye.Promise,e.channel===Faye.Channel.HANDSHAKE?(this.addTimeout("publish",.01,this._flush,this),this._promise):(e.channel===Faye.Channel.CONNECT&&(this._connectMessage=e),this.addTimeout("publish",this.MAX_DELAY,this._flush,this),this._promise)):Faye.Promise.fulfilled(this.request([e]))},_flush:function(){this.removeTimeout("publish"),this._outbox.length>1&&this._connectMessage&&(this._connectMessage.advice={timeout:0}),Faye.Promise.fulfill(this._promise,this.request(this._outbox)),delete this._promise,this._connectMessage=null,this._outbox=[]},_flushLargeBatch:function(){var e=this.encode(this._outbox);if(!(e.length<this._dispatcher.maxRequestSize)){var t=this._outbox.pop();this._flush(),t&&this._outbox.push(t)}},_receive:function(e){e=[].concat(e),this.debug("Client ? received from ? via ?: ?",this._dispatcher.clientId,Faye.URI.stringify(this.endpoint),this.connectionType,e);for(var t=0,n=e.length;n>t;t++)this._dispatcher.handleResponse(e[t])},_handleError:function(e){e=[].concat(e),this.debug("Client ? failed to send to ? via ?: ?",this._dispatcher.clientId,Faye.URI.stringify(this.endpoint),this.connectionType,e);for(var t=0,n=e.length;n>t;t++)this._dispatcher.handleError(e[t])},_getCookies:function(){var e=this._dispatcher.cookies,t=Faye.URI.stringify(this.endpoint);return e?Faye.map(e.getCookiesSync(t),function(e){return e.cookieString()}).join("; "):""},_storeCookies:function(e){var t,n=this._dispatcher.cookies,i=Faye.URI.stringify(this.endpoint);if(e&&n){e=[].concat(e);for(var s=0,r=e.length;r>s;s++)t=Faye.Cookies.Cookie.parse(e[s]),n.setCookieSync(t,i)}}}),{get:function(e,t,n,i,s){var r=e.endpoint;Faye.asyncEach(this._transports,function(r,o){var a=r[0],c=r[1],h=e.endpointFor(a);return Faye.indexOf(n,a)>=0?o():Faye.indexOf(t,a)<0?(c.isUsable(e,h,function(){}),o()):void c.isUsable(e,h,function(t){if(!t)return o();var n=c.hasOwnProperty("create")?c.create(e,h):new c(e,h);i.call(s,n)})},function(){throw Error("Could not find a usable connection type for "+Faye.URI.stringify(r))})},register:function(e,t){this._transports.push([e,t]),t.prototype.connectionType=e},getConnectionTypes:function(){return Faye.map(this._transports,function(e){return e[0]})},_transports:[]}),Faye.extend(Faye.Transport.prototype,Faye.Logging),Faye.extend(Faye.Transport.prototype,Faye.Timeouts),Faye.Event={_registry:[],on:function(e,t,n,i){var s=function(){n.call(i)};e.addEventListener?e.addEventListener(t,s,!1):e.attachEvent("on"+t,s),this._registry.push({_element:e,_type:t,_callback:n,_context:i,_handler:s})},detach:function(e,t,n,i){for(var s,r=this._registry.length;r--;)s=this._registry[r],e&&e!==s._element||t&&t!==s._type||n&&n!==s._callback||i&&i!==s._context||(s._element.removeEventListener?s._element.removeEventListener(s._type,s._handler,!1):s._element.detachEvent("on"+s._type,s._handler),this._registry.splice(r,1),s=null)}},void 0!==Faye.ENV.onunload&&Faye.Event.on(Faye.ENV,"unload",Faye.Event.detach,Faye.Event),"object"!=typeof JSON&&(JSON={}),function(){function f(e){return 10>e?"0"+e:e}function quote(e){return escapable.lastIndex=0,escapable.test(e)?'"'+e.replace(escapable,function(e){var t=meta[e];return"string"==typeof t?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'}function str(e,t){var n,i,s,r,o,a=gap,c=t[e];switch(c&&"object"==typeof c&&"function"==typeof c.toJSON&&(c=c.toJSON(e)),"function"==typeof rep&&(c=rep.call(t,e,c)),typeof c){case"string":return quote(c);case"number":return isFinite(c)?c+"":"null";case"boolean":case"null":return c+"";case"object":if(!c)return"null";if(gap+=indent,o=[],"[object Array]"===Object.prototype.toString.apply(c)){for(r=c.length,n=0;r>n;n+=1)o[n]=str(n,c)||"null";return s=0===o.length?"[]":gap?"[\n"+gap+o.join(",\n"+gap)+"\n"+a+"]":"["+o.join(",")+"]",gap=a,s}if(rep&&"object"==typeof rep)for(r=rep.length,n=0;r>n;n+=1)"string"==typeof rep[n]&&(i=rep[n],s=str(i,c),s&&o.push(quote(i)+(gap?": ":":")+s));else for(i in c)Object.prototype.hasOwnProperty.call(c,i)&&(s=str(i,c),s&&o.push(quote(i)+(gap?": ":":")+s));return s=0===o.length?"{}":gap?"{\n"+gap+o.join(",\n"+gap)+"\n"+a+"}":"{"+o.join(",")+"}",gap=a,s}}"function"!=typeof Date.prototype.toJSON&&(Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null},String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(){return this.valueOf()});var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;Faye.stringify=function(e,t,n){var i;if(gap="",indent="","number"==typeof n)for(i=0;n>i;i+=1)indent+=" ";else"string"==typeof n&&(indent=n);if(rep=t,t&&"function"!=typeof t&&("object"!=typeof t||"number"!=typeof t.length))throw Error("JSON.stringify");return str("",{"":e})},"function"!=typeof JSON.stringify&&(JSON.stringify=Faye.stringify),"function"!=typeof JSON.parse&&(JSON.parse=function(text,reviver){function walk(e,t){var n,i,s=e[t];if(s&&"object"==typeof s)for(n in s)Object.prototype.hasOwnProperty.call(s,n)&&(i=walk(s,n),void 0!==i?s[n]=i:delete s[n]);
|
2
|
+
return reviver.call(e,t,s)}var j;if(text+="",cx.lastIndex=0,cx.test(text)&&(text=text.replace(cx,function(e){return"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})),/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return j=eval("("+text+")"),"function"==typeof reviver?walk({"":j},""):j;throw new SyntaxError("JSON.parse")})}(),Faye.Transport.WebSocket=Faye.extend(Faye.Class(Faye.Transport,{UNCONNECTED:1,CONNECTING:2,CONNECTED:3,batching:!1,isUsable:function(e,t){this.callback(function(){e.call(t,!0)}),this.errback(function(){e.call(t,!1)}),this.connect()},request:function(e){this._pending=this._pending||new Faye.Set;for(var t=0,n=e.length;n>t;t++)this._pending.add(e[t]);var i=new Faye.Promise;return this.callback(function(t){t&&(t.send(Faye.toJSON(e)),Faye.Promise.fulfill(i,t))},this),this.connect(),{abort:function(){i.then(function(e){e.close()})}}},connect:function(){if(!Faye.Transport.WebSocket._unloaded&&(this._state=this._state||this.UNCONNECTED,this._state===this.UNCONNECTED)){this._state=this.CONNECTING;var e=this._createSocket();if(!e)return this.setDeferredStatus("failed");var t=this;e.onopen=function(){e.headers&&t._storeCookies(e.headers["set-cookie"]),t._socket=e,t._state=t.CONNECTED,t._everConnected=!0,t._ping(),t.setDeferredStatus("succeeded",e)};var n=!1;e.onclose=e.onerror=function(){if(!n){n=!0;var i=t._state===t.CONNECTED;e.onopen=e.onclose=e.onerror=e.onmessage=null,delete t._socket,t._state=t.UNCONNECTED,t.removeTimeout("ping"),t.setDeferredStatus("unknown");var s=t._pending?t._pending.toArray():[];delete t._pending,i?t._handleError(s,!0):t._everConnected?t._handleError(s):t.setDeferredStatus("failed")}},e.onmessage=function(e){var n=JSON.parse(e.data);if(n){n=[].concat(n);for(var i=0,s=n.length;s>i;i++)void 0!==n[i].successful&&t._pending.remove(n[i]);t._receive(n)}}}},close:function(){this._socket&&this._socket.close()},_createSocket:function(){var e=Faye.Transport.WebSocket.getSocketUrl(this.endpoint),t=this._dispatcher.headers,n=this._dispatcher.wsExtensions,i=this._getCookies(),s=this._dispatcher.tls,r={extensions:n,headers:t,proxy:this._proxy,tls:s};return""!==i&&(r.headers.Cookie=i),Faye.WebSocket?new Faye.WebSocket.Client(e,[],r):Faye.ENV.MozWebSocket?new MozWebSocket(e):Faye.ENV.WebSocket?new WebSocket(e):void 0},_ping:function(){this._socket&&(this._socket.send("[]"),this.addTimeout("ping",this._dispatcher.timeout/2,this._ping,this))}}),{PROTOCOLS:{"http:":"ws:","https:":"wss:"},create:function(e,t){var n=e.transports.websocket=e.transports.websocket||{};return n[t.href]=n[t.href]||new this(e,t),n[t.href]},getSocketUrl:function(e){return e=Faye.copyObject(e),e.protocol=this.PROTOCOLS[e.protocol],Faye.URI.stringify(e)},isUsable:function(e,t,n,i){this.create(e,t).isUsable(n,i)}}),Faye.extend(Faye.Transport.WebSocket.prototype,Faye.Deferrable),Faye.Transport.register("websocket",Faye.Transport.WebSocket),Faye.Event&&void 0!==Faye.ENV.onbeforeunload&&Faye.Event.on(Faye.ENV,"beforeunload",function(){Faye.Transport.WebSocket._unloaded=!0}),Faye.Transport.EventSource=Faye.extend(Faye.Class(Faye.Transport,{initialize:function(e,t){if(Faye.Transport.prototype.initialize.call(this,e,t),!Faye.ENV.EventSource)return this.setDeferredStatus("failed");this._xhr=new Faye.Transport.XHR(e,t),t=Faye.copyObject(t),t.pathname+="/"+e.clientId;var n=new EventSource(Faye.URI.stringify(t)),i=this;n.onopen=function(){i._everConnected=!0,i.setDeferredStatus("succeeded")},n.onerror=function(){i._everConnected?i._handleError([]):(i.setDeferredStatus("failed"),n.close())},n.onmessage=function(e){i._receive(JSON.parse(e.data))},this._socket=n},close:function(){this._socket&&(this._socket.onopen=this._socket.onerror=this._socket.onmessage=null,this._socket.close(),delete this._socket)},isUsable:function(e,t){this.callback(function(){e.call(t,!0)}),this.errback(function(){e.call(t,!1)})},encode:function(e){return this._xhr.encode(e)},request:function(e){return this._xhr.request(e)}}),{isUsable:function(e,t,n,i){var s=e.clientId;return s?void Faye.Transport.XHR.isUsable(e,t,function(s){return s?void this.create(e,t).isUsable(n,i):n.call(i,!1)},this):n.call(i,!1)},create:function(e,t){var n=e.transports.eventsource=e.transports.eventsource||{},i=e.clientId;t=Faye.copyObject(t),t.pathname+="/"+(i||"");var s=Faye.URI.stringify(t);return n[s]=n[s]||new this(e,t),n[s]}}),Faye.extend(Faye.Transport.EventSource.prototype,Faye.Deferrable),Faye.Transport.register("eventsource",Faye.Transport.EventSource),Faye.Transport.XHR=Faye.extend(Faye.Class(Faye.Transport,{encode:function(e){return Faye.toJSON(e)},request:function(e){var t=this.endpoint.href,n=Faye.ENV.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest,i=this;n.open("POST",t,!0),n.setRequestHeader("Content-Type","application/json"),n.setRequestHeader("Pragma","no-cache"),n.setRequestHeader("X-Requested-With","XMLHttpRequest");var s=this._dispatcher.headers;for(var r in s)s.hasOwnProperty(r)&&n.setRequestHeader(r,s[r]);var o=function(){n.abort()};return void 0!==Faye.ENV.onbeforeunload&&Faye.Event.on(Faye.ENV,"beforeunload",o),n.onreadystatechange=function(){if(n&&4===n.readyState){var t=null,s=n.status,r=n.responseText,a=s>=200&&300>s||304===s||1223===s;if(void 0!==Faye.ENV.onbeforeunload&&Faye.Event.detach(Faye.ENV,"beforeunload",o),n.onreadystatechange=function(){},n=null,!a)return i._handleError(e);try{t=JSON.parse(r)}catch(c){}t?i._receive(t):i._handleError(e)}},n.send(this.encode(e)),n}}),{isUsable:function(e,t,n,i){n.call(i,Faye.URI.isSameOrigin(t))}}),Faye.Transport.register("long-polling",Faye.Transport.XHR),Faye.Transport.CORS=Faye.extend(Faye.Class(Faye.Transport,{encode:function(e){return"message="+encodeURIComponent(Faye.toJSON(e))},request:function(e){var t,n=Faye.ENV.XDomainRequest?XDomainRequest:XMLHttpRequest,i=new n,s=this._dispatcher.headers,r=this;if(i.open("POST",Faye.URI.stringify(this.endpoint),!0),i.setRequestHeader){i.setRequestHeader("Pragma","no-cache");for(t in s)s.hasOwnProperty(t)&&i.setRequestHeader(t,s[t])}var o=function(){return i?(i.onload=i.onerror=i.ontimeout=i.onprogress=null,void(i=null)):!1};return i.onload=function(){var t=null;try{t=JSON.parse(i.responseText)}catch(n){}o(),t?r._receive(t):r._handleError(e)},i.onerror=i.ontimeout=function(){o(),r._handleError(e)},i.onprogress=function(){},i.send(this.encode(e)),i}}),{isUsable:function(e,t,n,i){if(Faye.URI.isSameOrigin(t))return n.call(i,!1);if(Faye.ENV.XDomainRequest)return n.call(i,t.protocol===Faye.ENV.location.protocol);if(Faye.ENV.XMLHttpRequest){var s=new Faye.ENV.XMLHttpRequest;return n.call(i,void 0!==s.withCredentials)}return n.call(i,!1)}}),Faye.Transport.register("cross-origin-long-polling",Faye.Transport.CORS),Faye.Transport.JSONP=Faye.extend(Faye.Class(Faye.Transport,{encode:function(e){var t=Faye.copyObject(this.endpoint);return t.query.message=Faye.toJSON(e),t.query.jsonp="__jsonp"+Faye.Transport.JSONP._cbCount+"__",Faye.URI.stringify(t)},request:function(e){var t=document.getElementsByTagName("head")[0],n=document.createElement("script"),i=Faye.Transport.JSONP.getCallbackName(),s=Faye.copyObject(this.endpoint),r=this;s.query.message=Faye.toJSON(e),s.query.jsonp=i;var o=function(){if(!Faye.ENV[i])return!1;Faye.ENV[i]=void 0;try{delete Faye.ENV[i]}catch(e){}n.parentNode.removeChild(n)};return Faye.ENV[i]=function(e){o(),r._receive(e)},n.type="text/javascript",n.src=Faye.URI.stringify(s),t.appendChild(n),n.onerror=function(){o(),r._handleError(e)},{abort:o}}}),{_cbCount:0,getCallbackName:function(){return this._cbCount+=1,"__jsonp"+this._cbCount+"__"},isUsable:function(e,t,n,i){n.call(i,!0)}}),Faye.Transport.register("callback-polling",Faye.Transport.JSONP)}();
|
2
3
|
//# sourceMappingURL=faye-browser-min.js.map
|
data/lib/faye-browser-min.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["faye-browser.js"],"names":["Faye","VERSION","BAYEUX_VERSION","ID_LENGTH","JSONP_CALLBACK","CONNECTION_TYPES","MANDATORY_CONNECTION_TYPES","ENV","window","global","extend","dest","source","overwrite","key","hasOwnProperty","random","bitlength","this","csprng","clientIdFromMessages","messages","connect","filter","concat","message","channel","clientId","copyObject","object","clone","i","Array","length","commonElement","lista","listb","n","indexOf","list","needle","map","callback","context","result","push","call","array","asyncEach","iterator","calls","looping","iterate","resume","loop","toJSON","stringify","value","JSON","module","exports","Class","parent","methods","Object","klass","initialize","apply","arguments","bridge","prototype","xs","x","EventEmitter","isArray","toString","emit","type","_events","error","Error","handler","args","slice","listeners","l","addListener","listener","on","once","self","g","removeListener","splice","removeAllListeners","Namespace","_used","exists","id","generate","name","release","defer","timeout","setTimeout","setImmediate","fn","process","nextTick","PENDING","FULFILLED","REJECTED","RETURN","THROW","Promise","task","_state","_callbacks","_errbacks","fulfill","reason","reject","then","errback","next","promise","registerCallback","registerErrback","invoke","_value","_reason","_invoke","outcome","called","TypeError","v","r","resolve","cb","callbacks","shift","eb","errbacks","deferred","pending","tuple","fulfilled","resolved","rejected","Set","_index","add","item","undefined","forEach","block","isEmpty","member","remove","removed","toArray","URI","isURI","uri","protocol","host","path","isSameOrigin","location","hostname","port","parse","url","parts","query","pairs","data","consume","pattern","replace","match","test","pathname","substr","split","search","decodeURIComponent","href","string","queryString","hash","encodeURIComponent","join","code","params","Grammar","ERROR","parseInt","versionMismatch","conntypeMismatch","extMismatch","badRequest","clientUnknown","parameterMissing","channelForbidden","channelUnknown","channelInvalid","extUnknown","publishFailed","serverError","Deferrable","_promise","_fulfill","_reject","seconds","_timer","setDeferredStatus","status","clearTimeout","Publisher","countListeners","eventType","bind","_listeners","unbind","trigger","Timeouts","addTimeout","delay","_timeouts","removeTimeout","removeAllTimeouts","Logging","LOG_LEVELS","fatal","warn","info","debug","writeLog","messageArgs","level","logger","banner","className","e","CHANNEL_NAME","CHANNEL_PATTERN","Extensible","addExtension","extension","_extensions","added","removeExtension","pipeThroughExtensions","stage","request","extensions","pipe","Channel","isUnused","HANDSHAKE","CONNECT","SUBSCRIBE","UNSUBSCRIBE","DISCONNECT","META","SERVICE","expand","segments","channels","copy","unparse","isValid","isMeta","isService","isSubscribable","_channels","getKeys","keys","hasSubscription","subscribe","names","unsubscribe","distributeMessage","Envelope","Publication","Subscription","client","_client","_callback","_context","_cancelled","cancel","Client","UNCONNECTED","CONNECTING","CONNECTED","DISCONNECTED","RETRY","NONE","CONNECTION_TIMEOUT","DEFAULT_RETRY","MAX_REQUEST_SIZE","DEFAULT_ENDPOINT","INTERVAL","endpoint","options","_options","endpoints","transports","cookies","CookieJar","headers","ca","_disabled","_retry","retry","maxRequestSize","_messageId","_responseCallbacks","_advice","reconnect","interval","Event","onbeforeunload","disconnect","disable","feature","setHeader","handshake","_selectTransport","_send","version","supportedConnectionTypes","_transport","connectionType","response","successful","_clientId","_connectRequest","_cycleConnection","close","c","subscription","force","publish","publication","receiveMessage","advice","_handleAdvice","_deliverMessage","_transportUp","messageError","immediate","_transportSend","transportTypes","Transport","get","transport","_generateMessageId","envelope","send","Math","pow","MAX_DELAY","batching","_outbox","encode","envelopes","flush","_connectMessage","flushLargeBatch","last","pop","receive","responses","handleError","_getCookies","getCookies","domain","secure","toValueString","_storeCookies","setCookie","cookie","allowed","disabled","_transports","pair","connType","connEndpoint","isUsable","create","register","_registry","element","eventName","wrapped","addEventListener","attachEvent","_element","_type","_handler","detach","removeEventListener","detachEvent","onunload","f","quote","escapable","lastIndex","a","meta","charCodeAt","str","holder","k","partial","mind","gap","rep","isFinite","String","indent","Date","valueOf","getUTCFullYear","getUTCMonth","getUTCDate","getUTCHours","getUTCMinutes","getUTCSeconds","Number","Boolean","cx","\b","\t","\n","\f","\r","\"","\\","replacer","space","","text","reviver","walk","j","eval","SyntaxError","WebSocket","_pending","socket","_unloaded","_createSocket","onopen","_socket","_everConnected","_ping","closed","onclose","onerror","wasConnected","onmessage","event","getSocketUrl","MozWebSocket","PROTOCOLS","http:","https:","sockets","websocket","EventSource","_xhr","XHR","usable","eventsource","xhr","ActiveXObject","XMLHttpRequest","open","setRequestHeader","abort","onreadystatechange","readyState","parsedMessage","responseText","CORS","xhrClass","XDomainRequest","cleanUp","onload","ontimeout","onprogress","withCredentials","JSONP","jsonp","_cbCount","head","document","getElementsByT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,QAAUzB,KAAKuD,OAAOlC,GAChCuJ,EAAIE,MAAMmU,MAAU,UAAYjf,KAAKoW,UAAU4I,MAAME,SAAW,KACzDlf,KAAKiK,IAAIzG,UAAUoH,IAG5BmF,QAAS,SAASiH,GAChB,GAAI3V,GAAerB,KAAKyC,IAAIuU,EAAW,SAAS5H,GAAK,MAAOA,GAAE3N,UAC1D0d,EAAeC,SAASC,qBAAqB,QAAQ,GACrDC,EAAeF,SAASG,cAAc,UACtCC,EAAexf,KAAKoW,UAAU4I,MAAMS,kBACpCxM,EAAejT,KAAK4B,WAAWV,KAAK+R,UACpCvN,EAAexE,IAEnB+R,GAASnI,MAAMrJ,QAAUzB,KAAKuD,OAAOlC,GACrC4R,EAASnI,MAAMmU,MAAUO,EAEzBxf,KAAKO,IAAIif,GAAgB,SAASxU,GAChC,IAAKhL,KAAKO,IAAIif,GAAe,OAAO,CACpCxf,MAAKO,IAAIif,OAAgB/V,EACzB,WAAazJ,MAAKO,IAAIif,GAAgB,MAAOpQ,IAC7CkQ,EAAOI,WAAWC,YAAYL,GAC9B5Z,EAAK4R,QAAQN,EAAWhM,IAG1BsU,EAAOza,KAAO,kBACdya,EAAOM,IAAO5f,KAAKiK,IAAIzG,UAAUyP,GACjCkM,EAAKU,YAAYP,OAGnBJ,SAAU,EAEVO,gBAAiB,WAEf,MADAve,MAAKge,UAAY,EACV,UAAYhe,KAAKge,SAAW,MAGrC3G,SAAU,SAASxG,EAAQkB,EAAUvQ,EAAUC,GAC7CD,EAASI,KAAKH,GAAS,MAI3B3C,KAAKoW,UAAUqC,SAAS,mBAAoBzY,KAAKoW,UAAU4I","file":"faye-browser-min.js","sourceRoot":""}
|
1
|
+
{"version":3,"file":"faye-browser-min.js","sources":["faye-browser.js"],"names":["Faye","VERSION","BAYEUX_VERSION","ID_LENGTH","JSONP_CALLBACK","CONNECTION_TYPES","MANDATORY_CONNECTION_TYPES","ENV","window","global","extend","dest","source","overwrite","key","hasOwnProperty","random","bitlength","this","maxLength","Math","ceil","log","string","csprng","length","validateOptions","options","validKeys","indexOf","Error","clientIdFromMessages","messages","connect","filter","concat","message","channel","clientId","copyObject","object","clone","i","Array","commonElement","lista","listb","n","list","needle","map","callback","context","result","push","call","array","asyncEach","iterator","calls","looping","iterate","resume","loop","toJSON","stringify","value","JSON","module","exports","Class","parent","methods","Object","klass","initialize","apply","arguments","bridge","prototype","xs","x","EventEmitter","isArray","toString","emit","type","_events","error","handler","args","slice","listeners","l","addListener","listener","on","once","self","g","removeListener","splice","removeAllListeners","Namespace","_used","exists","id","generate","name","release","defer","timeout","setTimeout","setImmediate","fn","process","nextTick","PENDING","FULFILLED","REJECTED","RETURN","THROW","Promise","task","_state","_onFulfilled","_onRejected","fulfill","reason","reject","then","onFulfilled","onRejected","next","registerOnFulfilled","registerOnRejected","promise","invoke","_value","_reason","_invoke","outcome","TypeError","resolve","called","_fulfill","v","r","shift","all","promises","fulfilled","deferred","pending","tuple","resolved","rejected","Set","_index","add","item","undefined","forEach","block","isEmpty","member","remove","removed","toArray","URI","isURI","uri","protocol","host","path","isSameOrigin","location","hostname","port","parse","url","parts","query","pairs","data","consume","pattern","replace","match","test","pathname","substr","split","search","decodeURIComponent","href","queryString","hash","encodeURIComponent","join","code","params","Grammar","ERROR","parseInt","versionMismatch","conntypeMismatch","extMismatch","badRequest","clientUnknown","parameterMissing","channelForbidden","channelUnknown","channelInvalid","extUnknown","publishFailed","serverError","Deferrable","errback","_promise","_reject","seconds","_timer","setDeferredStatus","status","clearTimeout","Publisher","countListeners","eventType","bind","_listeners","unbind","trigger","Timeouts","addTimeout","delay","_timeouts","removeTimeout","removeAllTimeouts","Logging","LOG_LEVELS","fatal","warn","info","debug","writeLog","messageArgs","level","logger","banner","className","e","CHANNEL_NAME","CHANNEL_PATTERN","Extensible","addExtension","extension","_extensions","added","removeExtension","pipeThroughExtensions","stage","request","extensions","pipe","Channel","isUnused","HANDSHAKE","CONNECT","SUBSCRIBE","UNSUBSCRIBE","DISCONNECT","META","SERVICE","expand","segments","channels","copy","unparse","isValid","isMeta","isService","isSubscribable","_channels","getKeys","keys","hasSubscription","subscribe","names","unsubscribe","distributeMessage","Publication","Subscription","client","_client","_callback","_context","_cancelled","cancel","Client","UNCONNECTED","CONNECTING","CONNECTED","DISCONNECTED","RETRY","NONE","CONNECTION_TIMEOUT","DEFAULT_ENDPOINT","INTERVAL","endpoint","_endpoint","_dispatcher","Dispatcher","_messageId","_responseCallbacks","_advice","reconnect","interval","_receiveMessage","Event","onbeforeunload","_disabled","disconnect","addWebsocketExtension","disable","feature","setHeader","handshake","selectTransport","_sendMessage","version","supportedConnectionTypes","getConnectionTypes","response","successful","retry","_connectRequest","connectionType","_cycleConnection","close","c","subscription","force","hasSubscribe","dead","publish","publication","_generateMessageId","sendMessage","pow","advice","_handleAdvice","_deliverMessage","MAX_REQUEST_SIZE","DEFAULT_RETRY","UP","DOWN","_alternates","endpoints","cookies","Cookies","CookieJar","_envelopes","headers","_scheduler","scheduler","Scheduler","transports","wsExtensions","proxy","_proxy","origin","exts","websocketExtensions","tls","ca","maxRequestSize","endpointFor","transport","_transport","Transport","transportTypes","get","attempts","deadline","Date","getTime","envelope","_sendEnvelope","timer","isDeliverable","abort","handleError","getTimeout","send","handleResponse","reply","succeed","immediate","req","fail","getInterval","made","now","DEFAULT_PORTS","http:","https:","ws:","wss:","SECURE_PROTOCOLS","MAX_DELAY","batching","dispatcher","_outbox","NodeAdapter","env","HTTPS_PROXY","https_proxy","HTTP_PROXY","http_proxy","encode","_flushLargeBatch","_flush","_connectMessage","last","pop","_receive","replies","_handleError","_getCookies","getCookiesSync","cookie","cookieString","_storeCookies","setCookie","Cookie","setCookieSync","allowed","disabled","_transports","pair","connType","connEndpoint","isUsable","create","register","t","_registry","element","eventName","wrapped","addEventListener","attachEvent","_element","_type","_handler","detach","removeEventListener","detachEvent","onunload","f","quote","escapable","lastIndex","a","meta","charCodeAt","str","holder","k","partial","mind","gap","rep","isFinite","String","indent","valueOf","getUTCFullYear","getUTCMonth","getUTCDate","getUTCHours","getUTCMinutes","getUTCSeconds","Number","Boolean","cx","\b","\t","\n","\f","\r","\"","\\","replacer","space","text","reviver","walk","j","eval","SyntaxError","WebSocket","_pending","socket","ws","_unloaded","_createSocket","onopen","_socket","_everConnected","_ping","closed","onclose","onerror","wasConnected","onmessage","event","getSocketUrl","MozWebSocket","PROTOCOLS","sockets","websocket","EventSource","_xhr","XHR","usable","eventsource","xhr","ActiveXObject","XMLHttpRequest","open","setRequestHeader","onreadystatechange","readyState","responseText","CORS","xhrClass","XDomainRequest","cleanUp","onload","ontimeout","onprogress","withCredentials","JSONP","jsonp","_cbCount","head","document","getElementsByTagName","script","createElement","callbackName","getCallbackName","cleanup","parentNode","removeChild","src","appendChild"],"mappings":"CAAA,WACA,YAEA,IAAIA,OACFC,QAAkB,QAElBC,eAAkB,MAClBC,UAAkB,IAClBC,eAAkB,gBAClBC,kBAAmB,eAAgB,4BAA6B,mBAAoB,YAAa,cAAe,cAEhHC,4BAA6B,eAAgB,mBAAoB,cAEjEC,IAAwB,mBAAXC,QAA0BA,OAASC,OAEhDC,OAAQ,SAASC,EAAMC,EAAQC,GAC7B,IAAKD,EAAQ,MAAOD,EACpB,KAAK,GAAIG,KAAOF,GACTA,EAAOG,eAAeD,KACvBH,EAAKI,eAAeD,IAAQD,KAAc,GAC1CF,EAAKG,KAASF,EAAOE,KACvBH,EAAKG,GAAOF,EAAOE,IAEvB,OAAOH,IAGTK,OAAQ,SAASC,GACfA,EAAYA,GAAaC,KAAKf,SAG9B,KAFA,GAAIgB,GAAYC,KAAKC,KAAKJ,EAAYG,KAAKE,IAAI,GAAKF,KAAKE,IAAI,KACzDC,EAASC,OAAOP,EAAW,IACxBM,EAAOE,OAASN,GAAWI,EAAS,IAAMA,CACjD,OAAOA,IAGTG,gBAAiB,SAASC,EAASC,GACjC,IAAK,GAAId,KAAOa,GACd,GAAIT,KAAKW,QAAQD,EAAWd,GAAO,EACjC,KAAUgB,OAAM,wBAA0BhB,IA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UoP,GACjC8O,EAAKW,YAAYR,GAEjBA,EAAOpC,QAAU,WACfwC,IACAxc,EAAK0U,aAAa5Y,KAGZuW,MAAOmK,OAGjBR,SAAU,EAEVO,gBAAiB,WAEf,MADAvhB,MAAKghB,UAAY,EACV,UAAYhhB,KAAKghB,SAAW,MAGrCvG,SAAU,SAAS/B,EAAYvG,EAAUlQ,EAAUC,GACjDD,EAASI,KAAKH,GAAS,MAI3BpD,KAAK4X,UAAUiE,SAAS,mBAAoB7b,KAAK4X,UAAUoK"}
|
data/lib/faye-browser.js
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
'use strict';
|
3
3
|
|
4
4
|
var Faye = {
|
5
|
-
VERSION: '1.0
|
5
|
+
VERSION: '1.1.0',
|
6
6
|
|
7
7
|
BAYEUX_VERSION: '1.0',
|
8
8
|
ID_LENGTH: 160,
|
@@ -26,7 +26,17 @@ var Faye = {
|
|
26
26
|
|
27
27
|
random: function(bitlength) {
|
28
28
|
bitlength = bitlength || this.ID_LENGTH;
|
29
|
-
|
29
|
+
var maxLength = Math.ceil(bitlength * Math.log(2) / Math.log(36));
|
30
|
+
var string = csprng(bitlength, 36);
|
31
|
+
while (string.length < maxLength) string = '0' + string;
|
32
|
+
return string;
|
33
|
+
},
|
34
|
+
|
35
|
+
validateOptions: function(options, validKeys) {
|
36
|
+
for (var key in options) {
|
37
|
+
if (this.indexOf(validKeys, key) < 0)
|
38
|
+
throw new Error('Unrecognized option: ' + key);
|
39
|
+
}
|
30
40
|
},
|
31
41
|
|
32
42
|
clientIdFromMessages: function(messages) {
|
@@ -357,9 +367,8 @@ Faye.Namespace = Faye.Class({
|
|
357
367
|
(function() {
|
358
368
|
'use strict';
|
359
369
|
|
360
|
-
var timeout = setTimeout;
|
370
|
+
var timeout = setTimeout, defer;
|
361
371
|
|
362
|
-
var defer;
|
363
372
|
if (typeof setImmediate === 'function')
|
364
373
|
defer = function(fn) { setImmediate(fn) };
|
365
374
|
else if (typeof process === 'object' && process.nextTick)
|
@@ -372,12 +381,12 @@ var PENDING = 0,
|
|
372
381
|
REJECTED = 2;
|
373
382
|
|
374
383
|
var RETURN = function(x) { return x },
|
375
|
-
THROW = function(x) { throw
|
384
|
+
THROW = function(x) { throw x };
|
376
385
|
|
377
386
|
var Promise = function(task) {
|
378
|
-
this._state
|
379
|
-
this.
|
380
|
-
this.
|
387
|
+
this._state = PENDING;
|
388
|
+
this._onFulfilled = [];
|
389
|
+
this._onRejected = [];
|
381
390
|
|
382
391
|
if (typeof task !== 'function') return;
|
383
392
|
var self = this;
|
@@ -386,34 +395,30 @@ var Promise = function(task) {
|
|
386
395
|
function(reason) { reject(self, reason) });
|
387
396
|
};
|
388
397
|
|
389
|
-
Promise.prototype.then = function(
|
390
|
-
var next =
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
next.reject = reject;
|
395
|
-
|
396
|
-
registerCallback(self, callback, next);
|
397
|
-
registerErrback(self, errback, next);
|
398
|
-
});
|
399
|
-
return next.promise;
|
398
|
+
Promise.prototype.then = function(onFulfilled, onRejected) {
|
399
|
+
var next = new Promise();
|
400
|
+
registerOnFulfilled(this, onFulfilled, next);
|
401
|
+
registerOnRejected(this, onRejected, next);
|
402
|
+
return next;
|
400
403
|
};
|
401
404
|
|
402
|
-
var
|
403
|
-
if (typeof
|
404
|
-
var handler = function(value) { invoke(
|
405
|
+
var registerOnFulfilled = function(promise, onFulfilled, next) {
|
406
|
+
if (typeof onFulfilled !== 'function') onFulfilled = RETURN;
|
407
|
+
var handler = function(value) { invoke(onFulfilled, value, next) };
|
408
|
+
|
405
409
|
if (promise._state === PENDING) {
|
406
|
-
promise.
|
410
|
+
promise._onFulfilled.push(handler);
|
407
411
|
} else if (promise._state === FULFILLED) {
|
408
412
|
handler(promise._value);
|
409
413
|
}
|
410
414
|
};
|
411
415
|
|
412
|
-
var
|
413
|
-
if (typeof
|
414
|
-
var handler = function(reason) { invoke(
|
416
|
+
var registerOnRejected = function(promise, onRejected, next) {
|
417
|
+
if (typeof onRejected !== 'function') onRejected = THROW;
|
418
|
+
var handler = function(reason) { invoke(onRejected, reason, next) };
|
419
|
+
|
415
420
|
if (promise._state === PENDING) {
|
416
|
-
promise.
|
421
|
+
promise._onRejected.push(handler);
|
417
422
|
} else if (promise._state === REJECTED) {
|
418
423
|
handler(promise._reason);
|
419
424
|
}
|
@@ -424,55 +429,80 @@ var invoke = function(fn, value, next) {
|
|
424
429
|
};
|
425
430
|
|
426
431
|
var _invoke = function(fn, value, next) {
|
427
|
-
var
|
432
|
+
var outcome;
|
428
433
|
|
429
434
|
try {
|
430
435
|
outcome = fn(value);
|
431
|
-
|
432
|
-
|
436
|
+
} catch (error) {
|
437
|
+
return reject(next, error);
|
438
|
+
}
|
439
|
+
|
440
|
+
if (outcome === next) {
|
441
|
+
reject(next, new TypeError('Recursive promise chain detected'));
|
442
|
+
} else {
|
443
|
+
fulfill(next, outcome);
|
444
|
+
}
|
445
|
+
};
|
433
446
|
|
434
|
-
|
435
|
-
|
447
|
+
var fulfill = Promise.fulfill = Promise.resolve = function(promise, value) {
|
448
|
+
var called = false, type, then;
|
449
|
+
|
450
|
+
try {
|
451
|
+
type = typeof value;
|
452
|
+
then = value !== null && (type === 'function' || type === 'object') && value.then;
|
436
453
|
|
437
|
-
if (typeof then !== 'function') return
|
454
|
+
if (typeof then !== 'function') return _fulfill(promise, value);
|
438
455
|
|
439
|
-
then.call(
|
440
|
-
if (called) return;
|
441
|
-
|
442
|
-
_invoke(RETURN, v, next);
|
456
|
+
then.call(value, function(v) {
|
457
|
+
if (!(called ^ (called = true))) return;
|
458
|
+
fulfill(promise, v);
|
443
459
|
}, function(r) {
|
444
|
-
if (called) return;
|
445
|
-
|
446
|
-
next.reject(r);
|
460
|
+
if (!(called ^ (called = true))) return;
|
461
|
+
reject(promise, r);
|
447
462
|
});
|
448
|
-
|
449
463
|
} catch (error) {
|
450
|
-
if (called) return;
|
451
|
-
|
452
|
-
next.reject(error);
|
464
|
+
if (!(called ^ (called = true))) return;
|
465
|
+
reject(promise, error);
|
453
466
|
}
|
454
467
|
};
|
455
468
|
|
456
|
-
var
|
469
|
+
var _fulfill = function(promise, value) {
|
457
470
|
if (promise._state !== PENDING) return;
|
458
471
|
|
459
|
-
promise._state
|
460
|
-
promise._value
|
461
|
-
promise.
|
472
|
+
promise._state = FULFILLED;
|
473
|
+
promise._value = value;
|
474
|
+
promise._onRejected = [];
|
462
475
|
|
463
|
-
var
|
464
|
-
while (
|
476
|
+
var onFulfilled = promise._onFulfilled, fn;
|
477
|
+
while (fn = onFulfilled.shift()) fn(value);
|
465
478
|
};
|
466
479
|
|
467
480
|
var reject = Promise.reject = function(promise, reason) {
|
468
481
|
if (promise._state !== PENDING) return;
|
469
482
|
|
470
|
-
promise._state
|
471
|
-
promise._reason
|
472
|
-
promise.
|
483
|
+
promise._state = REJECTED;
|
484
|
+
promise._reason = reason;
|
485
|
+
promise._onFulfilled = [];
|
486
|
+
|
487
|
+
var onRejected = promise._onRejected, fn;
|
488
|
+
while (fn = onRejected.shift()) fn(reason);
|
489
|
+
};
|
490
|
+
|
491
|
+
Promise.all = function(promises) {
|
492
|
+
return new Promise(function(fulfill, reject) {
|
493
|
+
var list = [],
|
494
|
+
n = promises.length,
|
495
|
+
i;
|
496
|
+
|
497
|
+
if (n === 0) return fulfill(list);
|
473
498
|
|
474
|
-
|
475
|
-
|
499
|
+
for (i = 0; i < n; i++) (function(promise, i) {
|
500
|
+
Promise.fulfilled(promise).then(function(value) {
|
501
|
+
list[i] = value;
|
502
|
+
if (--n === 0) fulfill(list);
|
503
|
+
}, reject);
|
504
|
+
})(promises[i], i);
|
505
|
+
});
|
476
506
|
};
|
477
507
|
|
478
508
|
Promise.defer = defer;
|
@@ -744,7 +774,7 @@ Faye.Deferrable = {
|
|
744
774
|
setDeferredStatus: function(status, value) {
|
745
775
|
if (this._timer) Faye.ENV.clearTimeout(this._timer);
|
746
776
|
|
747
|
-
|
777
|
+
this.then();
|
748
778
|
|
749
779
|
if (status === 'succeeded')
|
750
780
|
this._fulfill(value);
|
@@ -801,7 +831,7 @@ Faye.Timeouts = {
|
|
801
831
|
this._timeouts = this._timeouts || {};
|
802
832
|
var timeout = this._timeouts[name];
|
803
833
|
if (!timeout) return;
|
804
|
-
clearTimeout(timeout);
|
834
|
+
Faye.ENV.clearTimeout(timeout);
|
805
835
|
delete this._timeouts[name];
|
806
836
|
},
|
807
837
|
|
@@ -823,13 +853,13 @@ Faye.Logging = {
|
|
823
853
|
writeLog: function(messageArgs, level) {
|
824
854
|
if (!Faye.logger) return;
|
825
855
|
|
826
|
-
var
|
827
|
-
banner
|
828
|
-
klass
|
856
|
+
var args = Array.prototype.slice.apply(messageArgs),
|
857
|
+
banner = '[Faye',
|
858
|
+
klass = this.className,
|
829
859
|
|
830
|
-
message =
|
860
|
+
message = args.shift().replace(/\?/g, function() {
|
831
861
|
try {
|
832
|
-
return Faye.toJSON(
|
862
|
+
return Faye.toJSON(args.shift());
|
833
863
|
} catch (e) {
|
834
864
|
return '[Object]';
|
835
865
|
}
|
@@ -852,11 +882,11 @@ Faye.Logging = {
|
|
852
882
|
|
853
883
|
(function() {
|
854
884
|
for (var key in Faye.Logging.LOG_LEVELS)
|
855
|
-
(function(level
|
885
|
+
(function(level) {
|
856
886
|
Faye.Logging[level] = function() {
|
857
887
|
this.writeLog(arguments, level);
|
858
888
|
};
|
859
|
-
})(key
|
889
|
+
})(key);
|
860
890
|
})();
|
861
891
|
|
862
892
|
Faye.Grammar = {
|
@@ -999,12 +1029,11 @@ Faye.extend(Faye.Channel, {
|
|
999
1029
|
},
|
1000
1030
|
|
1001
1031
|
subscribe: function(names, callback, context) {
|
1002
|
-
if (!callback) return;
|
1003
1032
|
var name;
|
1004
1033
|
for (var i = 0, n = names.length; i < n; i++) {
|
1005
1034
|
name = names[i];
|
1006
1035
|
var channel = this._channels[name] = this._channels[name] || new Faye.Channel(name);
|
1007
|
-
channel.bind('message', callback, context);
|
1036
|
+
if (callback) channel.bind('message', callback, context);
|
1008
1037
|
}
|
1009
1038
|
},
|
1010
1039
|
|
@@ -1032,17 +1061,6 @@ Faye.extend(Faye.Channel, {
|
|
1032
1061
|
})
|
1033
1062
|
});
|
1034
1063
|
|
1035
|
-
Faye.Envelope = Faye.Class({
|
1036
|
-
initialize: function(message, timeout) {
|
1037
|
-
this.id = message.id;
|
1038
|
-
this.message = message;
|
1039
|
-
|
1040
|
-
if (timeout !== undefined) this.timeout(timeout / 1000, false);
|
1041
|
-
}
|
1042
|
-
});
|
1043
|
-
|
1044
|
-
Faye.extend(Faye.Envelope.prototype, Faye.Deferrable);
|
1045
|
-
|
1046
1064
|
Faye.Publication = Faye.Class(Faye.Deferrable);
|
1047
1065
|
|
1048
1066
|
Faye.Subscription = Faye.Class({
|
@@ -1068,65 +1086,61 @@ Faye.Subscription = Faye.Class({
|
|
1068
1086
|
Faye.extend(Faye.Subscription.prototype, Faye.Deferrable);
|
1069
1087
|
|
1070
1088
|
Faye.Client = Faye.Class({
|
1071
|
-
UNCONNECTED:
|
1072
|
-
CONNECTING:
|
1073
|
-
CONNECTED:
|
1074
|
-
DISCONNECTED:
|
1089
|
+
UNCONNECTED: 1,
|
1090
|
+
CONNECTING: 2,
|
1091
|
+
CONNECTED: 3,
|
1092
|
+
DISCONNECTED: 4,
|
1075
1093
|
|
1076
|
-
HANDSHAKE:
|
1077
|
-
RETRY:
|
1078
|
-
NONE:
|
1094
|
+
HANDSHAKE: 'handshake',
|
1095
|
+
RETRY: 'retry',
|
1096
|
+
NONE: 'none',
|
1079
1097
|
|
1080
|
-
CONNECTION_TIMEOUT:
|
1081
|
-
DEFAULT_RETRY: 5,
|
1082
|
-
MAX_REQUEST_SIZE: 2048,
|
1098
|
+
CONNECTION_TIMEOUT: 60,
|
1083
1099
|
|
1084
|
-
DEFAULT_ENDPOINT:
|
1085
|
-
INTERVAL:
|
1100
|
+
DEFAULT_ENDPOINT: '/bayeux',
|
1101
|
+
INTERVAL: 0,
|
1086
1102
|
|
1087
1103
|
initialize: function(endpoint, options) {
|
1088
1104
|
this.info('New client created for ?', endpoint);
|
1105
|
+
options = options || {};
|
1089
1106
|
|
1090
|
-
|
1091
|
-
this.endpoint = Faye.URI.parse(endpoint || this.DEFAULT_ENDPOINT);
|
1092
|
-
this.endpoints = this._options.endpoints || {};
|
1093
|
-
this.transports = {};
|
1094
|
-
this.cookies = Faye.CookieJar && new Faye.CookieJar();
|
1095
|
-
this.headers = {};
|
1096
|
-
this.ca = this._options.ca;
|
1097
|
-
this._disabled = [];
|
1098
|
-
this._retry = this._options.retry || this.DEFAULT_RETRY;
|
1099
|
-
|
1100
|
-
for (var key in this.endpoints)
|
1101
|
-
this.endpoints[key] = Faye.URI.parse(this.endpoints[key]);
|
1107
|
+
Faye.validateOptions(options, ['interval', 'timeout', 'endpoints', 'proxy', 'retry', 'scheduler', 'websocketExtensions', 'tls', 'ca']);
|
1102
1108
|
|
1103
|
-
this.
|
1109
|
+
this._endpoint = endpoint || this.DEFAULT_ENDPOINT;
|
1110
|
+
this._channels = new Faye.Channel.Set();
|
1111
|
+
this._dispatcher = new Faye.Dispatcher(this, this._endpoint, options);
|
1104
1112
|
|
1105
|
-
this._state = this.UNCONNECTED;
|
1106
|
-
this._channels = new Faye.Channel.Set();
|
1107
1113
|
this._messageId = 0;
|
1114
|
+
this._state = this.UNCONNECTED;
|
1108
1115
|
|
1109
1116
|
this._responseCallbacks = {};
|
1110
1117
|
|
1111
1118
|
this._advice = {
|
1112
1119
|
reconnect: this.RETRY,
|
1113
|
-
interval: 1000 * (
|
1114
|
-
timeout: 1000 * (
|
1120
|
+
interval: 1000 * (options.interval || this.INTERVAL),
|
1121
|
+
timeout: 1000 * (options.timeout || this.CONNECTION_TIMEOUT)
|
1115
1122
|
};
|
1123
|
+
this._dispatcher.timeout = this._advice.timeout / 1000;
|
1124
|
+
|
1125
|
+
this._dispatcher.bind('message', this._receiveMessage, this);
|
1116
1126
|
|
1117
1127
|
if (Faye.Event && Faye.ENV.onbeforeunload !== undefined)
|
1118
1128
|
Faye.Event.on(Faye.ENV, 'beforeunload', function() {
|
1119
|
-
if (Faye.indexOf(this._disabled, 'autodisconnect') < 0)
|
1129
|
+
if (Faye.indexOf(this._dispatcher._disabled, 'autodisconnect') < 0)
|
1120
1130
|
this.disconnect();
|
1121
1131
|
}, this);
|
1122
1132
|
},
|
1123
1133
|
|
1134
|
+
addWebsocketExtension: function(extension) {
|
1135
|
+
return this._dispatcher.addWebsocketExtension(extension);
|
1136
|
+
},
|
1137
|
+
|
1124
1138
|
disable: function(feature) {
|
1125
|
-
this.
|
1139
|
+
return this._dispatcher.disable(feature);
|
1126
1140
|
},
|
1127
1141
|
|
1128
1142
|
setHeader: function(name, value) {
|
1129
|
-
this.
|
1143
|
+
return this._dispatcher.setHeader(name, value);
|
1130
1144
|
},
|
1131
1145
|
|
1132
1146
|
// Request
|
@@ -1155,30 +1169,30 @@ Faye.Client = Faye.Class({
|
|
1155
1169
|
this._state = this.CONNECTING;
|
1156
1170
|
var self = this;
|
1157
1171
|
|
1158
|
-
this.info('Initiating handshake with ?', Faye.URI.stringify(this.
|
1159
|
-
this.
|
1172
|
+
this.info('Initiating handshake with ?', Faye.URI.stringify(this._endpoint));
|
1173
|
+
this._dispatcher.selectTransport(Faye.MANDATORY_CONNECTION_TYPES);
|
1160
1174
|
|
1161
|
-
this.
|
1175
|
+
this._sendMessage({
|
1162
1176
|
channel: Faye.Channel.HANDSHAKE,
|
1163
1177
|
version: Faye.BAYEUX_VERSION,
|
1164
|
-
supportedConnectionTypes:
|
1178
|
+
supportedConnectionTypes: this._dispatcher.getConnectionTypes()
|
1165
1179
|
|
1166
|
-
}, function(response) {
|
1180
|
+
}, {}, function(response) {
|
1167
1181
|
|
1168
1182
|
if (response.successful) {
|
1169
|
-
this._state
|
1170
|
-
this.
|
1183
|
+
this._state = this.CONNECTED;
|
1184
|
+
this._dispatcher.clientId = response.clientId;
|
1171
1185
|
|
1172
|
-
this.
|
1186
|
+
this._dispatcher.selectTransport(response.supportedConnectionTypes);
|
1173
1187
|
|
1174
|
-
this.info('Handshake successful: ?', this.
|
1188
|
+
this.info('Handshake successful: ?', this._dispatcher.clientId);
|
1175
1189
|
|
1176
1190
|
this.subscribe(this._channels.getKeys(), true);
|
1177
1191
|
if (callback) Faye.Promise.defer(function() { callback.call(context) });
|
1178
1192
|
|
1179
1193
|
} else {
|
1180
1194
|
this.info('Handshake unsuccessful');
|
1181
|
-
Faye.ENV.setTimeout(function() { self.handshake(callback, context) }, this.
|
1195
|
+
Faye.ENV.setTimeout(function() { self.handshake(callback, context) }, this._dispatcher.retry * 1000);
|
1182
1196
|
this._state = this.UNCONNECTED;
|
1183
1197
|
}
|
1184
1198
|
}, this);
|
@@ -1203,21 +1217,21 @@ Faye.Client = Faye.Class({
|
|
1203
1217
|
this.callback(callback, context);
|
1204
1218
|
if (this._state !== this.CONNECTED) return;
|
1205
1219
|
|
1206
|
-
this.info('Calling deferred actions for ?', this.
|
1220
|
+
this.info('Calling deferred actions for ?', this._dispatcher.clientId);
|
1207
1221
|
this.setDeferredStatus('succeeded');
|
1208
1222
|
this.setDeferredStatus('unknown');
|
1209
1223
|
|
1210
1224
|
if (this._connectRequest) return;
|
1211
1225
|
this._connectRequest = true;
|
1212
1226
|
|
1213
|
-
this.info('Initiating connection for ?', this.
|
1227
|
+
this.info('Initiating connection for ?', this._dispatcher.clientId);
|
1214
1228
|
|
1215
|
-
this.
|
1229
|
+
this._sendMessage({
|
1216
1230
|
channel: Faye.Channel.CONNECT,
|
1217
|
-
clientId: this.
|
1218
|
-
connectionType: this.
|
1231
|
+
clientId: this._dispatcher.clientId,
|
1232
|
+
connectionType: this._dispatcher.connectionType
|
1219
1233
|
|
1220
|
-
}, this._cycleConnection, this);
|
1234
|
+
}, {}, this._cycleConnection, this);
|
1221
1235
|
},
|
1222
1236
|
|
1223
1237
|
// Request Response
|
@@ -1231,20 +1245,26 @@ Faye.Client = Faye.Class({
|
|
1231
1245
|
if (this._state !== this.CONNECTED) return;
|
1232
1246
|
this._state = this.DISCONNECTED;
|
1233
1247
|
|
1234
|
-
this.info('Disconnecting ?', this.
|
1248
|
+
this.info('Disconnecting ?', this._dispatcher.clientId);
|
1249
|
+
var promise = new Faye.Publication();
|
1235
1250
|
|
1236
|
-
this.
|
1251
|
+
this._sendMessage({
|
1237
1252
|
channel: Faye.Channel.DISCONNECT,
|
1238
|
-
clientId: this.
|
1253
|
+
clientId: this._dispatcher.clientId
|
1239
1254
|
|
1240
|
-
}, function(response) {
|
1241
|
-
if (
|
1242
|
-
|
1243
|
-
|
1255
|
+
}, {}, function(response) {
|
1256
|
+
if (response.successful) {
|
1257
|
+
this._dispatcher.close();
|
1258
|
+
promise.setDeferredStatus('succeeded');
|
1259
|
+
} else {
|
1260
|
+
promise.setDeferredStatus('failed', Faye.Error.parse(response.error));
|
1261
|
+
}
|
1244
1262
|
}, this);
|
1245
1263
|
|
1246
|
-
this.info('Clearing channel listeners for ?', this.
|
1264
|
+
this.info('Clearing channel listeners for ?', this._dispatcher.clientId);
|
1247
1265
|
this._channels = new Faye.Channel.Set();
|
1266
|
+
|
1267
|
+
return promise;
|
1248
1268
|
},
|
1249
1269
|
|
1250
1270
|
// Request Response
|
@@ -1274,22 +1294,22 @@ Faye.Client = Faye.Class({
|
|
1274
1294
|
}
|
1275
1295
|
|
1276
1296
|
this.connect(function() {
|
1277
|
-
this.info('Client ? attempting to subscribe to ?', this.
|
1297
|
+
this.info('Client ? attempting to subscribe to ?', this._dispatcher.clientId, channel);
|
1278
1298
|
if (!force) this._channels.subscribe([channel], callback, context);
|
1279
1299
|
|
1280
|
-
this.
|
1300
|
+
this._sendMessage({
|
1281
1301
|
channel: Faye.Channel.SUBSCRIBE,
|
1282
|
-
clientId: this.
|
1302
|
+
clientId: this._dispatcher.clientId,
|
1283
1303
|
subscription: channel
|
1284
1304
|
|
1285
|
-
}, function(response) {
|
1305
|
+
}, {}, function(response) {
|
1286
1306
|
if (!response.successful) {
|
1287
1307
|
subscription.setDeferredStatus('failed', Faye.Error.parse(response.error));
|
1288
1308
|
return this._channels.unsubscribe(channel, callback, context);
|
1289
1309
|
}
|
1290
1310
|
|
1291
1311
|
var channels = [].concat(response.subscription);
|
1292
|
-
this.info('Subscription acknowledged for ? to ?', this.
|
1312
|
+
this.info('Subscription acknowledged for ? to ?', this._dispatcher.clientId, channels);
|
1293
1313
|
subscription.setDeferredStatus('succeeded');
|
1294
1314
|
}, this);
|
1295
1315
|
}, this);
|
@@ -1317,18 +1337,18 @@ Faye.Client = Faye.Class({
|
|
1317
1337
|
if (!dead) return;
|
1318
1338
|
|
1319
1339
|
this.connect(function() {
|
1320
|
-
this.info('Client ? attempting to unsubscribe from ?', this.
|
1340
|
+
this.info('Client ? attempting to unsubscribe from ?', this._dispatcher.clientId, channel);
|
1321
1341
|
|
1322
|
-
this.
|
1342
|
+
this._sendMessage({
|
1323
1343
|
channel: Faye.Channel.UNSUBSCRIBE,
|
1324
|
-
clientId: this.
|
1344
|
+
clientId: this._dispatcher.clientId,
|
1325
1345
|
subscription: channel
|
1326
1346
|
|
1327
|
-
}, function(response) {
|
1347
|
+
}, {}, function(response) {
|
1328
1348
|
if (!response.successful) return;
|
1329
1349
|
|
1330
1350
|
var channels = [].concat(response.subscription);
|
1331
|
-
this.info('Unsubscription acknowledged for ? from ?', this.
|
1351
|
+
this.info('Unsubscription acknowledged for ? from ?', this._dispatcher.clientId, channels);
|
1332
1352
|
}, this);
|
1333
1353
|
}, this);
|
1334
1354
|
},
|
@@ -1339,18 +1359,19 @@ Faye.Client = Faye.Class({
|
|
1339
1359
|
// MAY include: * clientId MAY include: * id
|
1340
1360
|
// * id * error
|
1341
1361
|
// * ext * ext
|
1342
|
-
publish: function(channel, data) {
|
1362
|
+
publish: function(channel, data, options) {
|
1363
|
+
Faye.validateOptions(options || {}, ['attempts', 'deadline']);
|
1343
1364
|
var publication = new Faye.Publication();
|
1344
1365
|
|
1345
1366
|
this.connect(function() {
|
1346
|
-
this.info('Client ? queueing published message to ?: ?', this.
|
1367
|
+
this.info('Client ? queueing published message to ?: ?', this._dispatcher.clientId, channel, data);
|
1347
1368
|
|
1348
|
-
this.
|
1369
|
+
this._sendMessage({
|
1349
1370
|
channel: channel,
|
1350
1371
|
data: data,
|
1351
|
-
clientId: this.
|
1372
|
+
clientId: this._dispatcher.clientId
|
1352
1373
|
|
1353
|
-
}, function(response) {
|
1374
|
+
}, options, function(response) {
|
1354
1375
|
if (response.successful)
|
1355
1376
|
publication.setDeferredStatus('succeeded');
|
1356
1377
|
else
|
@@ -1361,8 +1382,28 @@ Faye.Client = Faye.Class({
|
|
1361
1382
|
return publication;
|
1362
1383
|
},
|
1363
1384
|
|
1364
|
-
|
1365
|
-
|
1385
|
+
_sendMessage: function(message, options, callback, context) {
|
1386
|
+
message.id = this._generateMessageId();
|
1387
|
+
|
1388
|
+
var timeout = this._advice.timeout
|
1389
|
+
? 1.2 * this._advice.timeout / 1000
|
1390
|
+
: 1.2 * this._dispatcher.retry;
|
1391
|
+
|
1392
|
+
this.pipeThroughExtensions('outgoing', message, null, function(message) {
|
1393
|
+
if (!message) return;
|
1394
|
+
if (callback) this._responseCallbacks[message.id] = [callback, context];
|
1395
|
+
this._dispatcher.sendMessage(message, timeout, options || {});
|
1396
|
+
}, this);
|
1397
|
+
},
|
1398
|
+
|
1399
|
+
_generateMessageId: function() {
|
1400
|
+
this._messageId += 1;
|
1401
|
+
if (this._messageId >= Math.pow(2,32)) this._messageId = 0;
|
1402
|
+
return this._messageId.toString(36);
|
1403
|
+
},
|
1404
|
+
|
1405
|
+
_receiveMessage: function(message) {
|
1406
|
+
var id = message.id, callback;
|
1366
1407
|
|
1367
1408
|
if (message.successful !== undefined) {
|
1368
1409
|
callback = this._responseCallbacks[id];
|
@@ -1371,39 +1412,112 @@ Faye.Client = Faye.Class({
|
|
1371
1412
|
|
1372
1413
|
this.pipeThroughExtensions('incoming', message, null, function(message) {
|
1373
1414
|
if (!message) return;
|
1374
|
-
|
1375
1415
|
if (message.advice) this._handleAdvice(message.advice);
|
1376
1416
|
this._deliverMessage(message);
|
1377
|
-
|
1378
1417
|
if (callback) callback[0].call(callback[1], message);
|
1379
1418
|
}, this);
|
1419
|
+
},
|
1420
|
+
|
1421
|
+
_handleAdvice: function(advice) {
|
1422
|
+
Faye.extend(this._advice, advice);
|
1423
|
+
this._dispatcher.timeout = this._advice.timeout / 1000;
|
1380
1424
|
|
1381
|
-
if (this.
|
1382
|
-
|
1383
|
-
|
1425
|
+
if (this._advice.reconnect === this.HANDSHAKE && this._state !== this.DISCONNECTED) {
|
1426
|
+
this._state = this.UNCONNECTED;
|
1427
|
+
this._dispatcher.clientId = null;
|
1428
|
+
this._cycleConnection();
|
1429
|
+
}
|
1384
1430
|
},
|
1385
1431
|
|
1386
|
-
|
1387
|
-
|
1388
|
-
|
1389
|
-
|
1432
|
+
_deliverMessage: function(message) {
|
1433
|
+
if (!message.channel || message.data === undefined) return;
|
1434
|
+
this.info('Client ? calling listeners for ? with ?', this._dispatcher.clientId, message.channel, message.data);
|
1435
|
+
this._channels.distributeMessage(message);
|
1436
|
+
},
|
1390
1437
|
|
1391
|
-
|
1392
|
-
|
1393
|
-
|
1438
|
+
_cycleConnection: function() {
|
1439
|
+
if (this._connectRequest) {
|
1440
|
+
this._connectRequest = null;
|
1441
|
+
this.info('Closed connection for ?', this._dispatcher.clientId);
|
1442
|
+
}
|
1443
|
+
var self = this;
|
1444
|
+
Faye.ENV.setTimeout(function() { self.connect() }, this._advice.interval);
|
1445
|
+
}
|
1446
|
+
});
|
1394
1447
|
|
1395
|
-
|
1396
|
-
|
1397
|
-
|
1398
|
-
|
1448
|
+
Faye.extend(Faye.Client.prototype, Faye.Deferrable);
|
1449
|
+
Faye.extend(Faye.Client.prototype, Faye.Publisher);
|
1450
|
+
Faye.extend(Faye.Client.prototype, Faye.Logging);
|
1451
|
+
Faye.extend(Faye.Client.prototype, Faye.Extensible);
|
1452
|
+
|
1453
|
+
Faye.Dispatcher = Faye.Class({
|
1454
|
+
MAX_REQUEST_SIZE: 2048,
|
1455
|
+
DEFAULT_RETRY: 5,
|
1456
|
+
|
1457
|
+
UP: 1,
|
1458
|
+
DOWN: 2,
|
1459
|
+
|
1460
|
+
initialize: function(client, endpoint, options) {
|
1461
|
+
this._client = client;
|
1462
|
+
this.endpoint = Faye.URI.parse(endpoint);
|
1463
|
+
this._alternates = options.endpoints || {};
|
1464
|
+
|
1465
|
+
this.cookies = Faye.Cookies && new Faye.Cookies.CookieJar();
|
1466
|
+
this._disabled = [];
|
1467
|
+
this._envelopes = {};
|
1468
|
+
this.headers = {};
|
1469
|
+
this.retry = options.retry || this.DEFAULT_RETRY;
|
1470
|
+
this._scheduler = options.scheduler || Faye.Scheduler;
|
1471
|
+
this._state = 0;
|
1472
|
+
this.transports = {};
|
1473
|
+
this.wsExtensions = [];
|
1474
|
+
|
1475
|
+
this.proxy = options.proxy || {};
|
1476
|
+
if (typeof this._proxy === 'string') this._proxy = {origin: this._proxy};
|
1477
|
+
|
1478
|
+
var exts = options.websocketExtensions;
|
1479
|
+
if (exts) {
|
1480
|
+
exts = [].concat(exts);
|
1481
|
+
for (var i = 0, n = exts.length; i < n; i++)
|
1482
|
+
this.addWebsocketExtension(exts[i]);
|
1399
1483
|
}
|
1400
1484
|
|
1401
|
-
|
1402
|
-
this.
|
1403
|
-
|
1485
|
+
this.tls = options.tls || {};
|
1486
|
+
this.tls.ca = this.tls.ca || options.ca;
|
1487
|
+
|
1488
|
+
for (var type in this._alternates)
|
1489
|
+
this._alternates[type] = Faye.URI.parse(this._alternates[type]);
|
1490
|
+
|
1491
|
+
this.maxRequestSize = this.MAX_REQUEST_SIZE;
|
1404
1492
|
},
|
1405
1493
|
|
1406
|
-
|
1494
|
+
endpointFor: function(connectionType) {
|
1495
|
+
return this._alternates[connectionType] || this.endpoint;
|
1496
|
+
},
|
1497
|
+
|
1498
|
+
addWebsocketExtension: function(extension) {
|
1499
|
+
this.wsExtensions.push(extension);
|
1500
|
+
},
|
1501
|
+
|
1502
|
+
disable: function(feature) {
|
1503
|
+
this._disabled.push(feature);
|
1504
|
+
},
|
1505
|
+
|
1506
|
+
setHeader: function(name, value) {
|
1507
|
+
this.headers[name] = value;
|
1508
|
+
},
|
1509
|
+
|
1510
|
+
close: function() {
|
1511
|
+
var transport = this._transport;
|
1512
|
+
delete this._transport;
|
1513
|
+
if (transport) transport.close();
|
1514
|
+
},
|
1515
|
+
|
1516
|
+
getConnectionTypes: function() {
|
1517
|
+
return Faye.Transport.getConnectionTypes();
|
1518
|
+
},
|
1519
|
+
|
1520
|
+
selectTransport: function(transportTypes) {
|
1407
1521
|
Faye.Transport.get(this, transportTypes, this._disabled, function(transport) {
|
1408
1522
|
this.debug('Selected ? transport for ?', transport.connectionType, Faye.URI.stringify(transport.endpoint));
|
1409
1523
|
|
@@ -1411,186 +1525,274 @@ Faye.Client = Faye.Class({
|
|
1411
1525
|
if (this._transport) this._transport.close();
|
1412
1526
|
|
1413
1527
|
this._transport = transport;
|
1528
|
+
this.connectionType = transport.connectionType;
|
1414
1529
|
}, this);
|
1415
1530
|
},
|
1416
1531
|
|
1417
|
-
|
1532
|
+
sendMessage: function(message, timeout, options) {
|
1418
1533
|
if (!this._transport) return;
|
1419
|
-
|
1534
|
+
options = options || {};
|
1420
1535
|
|
1421
|
-
|
1422
|
-
|
1423
|
-
|
1424
|
-
|
1425
|
-
|
1536
|
+
var id = message.id,
|
1537
|
+
attempts = options.attempts,
|
1538
|
+
deadline = options.deadline && new Date().getTime() + (options.deadline * 1000),
|
1539
|
+
envelope = this._envelopes[id],
|
1540
|
+
scheduler;
|
1541
|
+
|
1542
|
+
if (!envelope) {
|
1543
|
+
scheduler = new this._scheduler(message, {timeout: timeout, interval: this.retry, attempts: attempts, deadline: deadline});
|
1544
|
+
envelope = this._envelopes[id] = {message: message, scheduler: scheduler};
|
1545
|
+
}
|
1546
|
+
|
1547
|
+
this._sendEnvelope(envelope);
|
1426
1548
|
},
|
1427
1549
|
|
1428
|
-
|
1429
|
-
if (
|
1550
|
+
_sendEnvelope: function(envelope) {
|
1551
|
+
if (envelope.request || envelope.timer) return;
|
1430
1552
|
|
1431
|
-
var
|
1432
|
-
|
1553
|
+
var message = envelope.message,
|
1554
|
+
scheduler = envelope.scheduler,
|
1555
|
+
self = this;
|
1433
1556
|
|
1434
|
-
|
1435
|
-
|
1436
|
-
|
1557
|
+
if (!scheduler.isDeliverable()) {
|
1558
|
+
scheduler.abort();
|
1559
|
+
delete this._envelopes[message.id];
|
1560
|
+
return;
|
1561
|
+
}
|
1437
1562
|
|
1438
|
-
|
1439
|
-
|
1563
|
+
envelope.timer = Faye.ENV.setTimeout(function() {
|
1564
|
+
self.handleError(message);
|
1565
|
+
}, scheduler.getTimeout() * 1000);
|
1440
1566
|
|
1441
|
-
|
1442
|
-
|
1443
|
-
if (this._messageId >= Math.pow(2,32)) this._messageId = 0;
|
1444
|
-
return this._messageId.toString(36);
|
1567
|
+
scheduler.send();
|
1568
|
+
envelope.request = this._transport.sendMessage(message);
|
1445
1569
|
},
|
1446
1570
|
|
1447
|
-
|
1448
|
-
|
1571
|
+
handleResponse: function(reply) {
|
1572
|
+
var envelope = this._envelopes[reply.id];
|
1449
1573
|
|
1450
|
-
if (
|
1451
|
-
|
1452
|
-
this.
|
1453
|
-
|
1574
|
+
if (reply.successful !== undefined && envelope) {
|
1575
|
+
envelope.scheduler.succeed();
|
1576
|
+
delete this._envelopes[reply.id];
|
1577
|
+
Faye.ENV.clearTimeout(envelope.timer);
|
1454
1578
|
}
|
1455
|
-
},
|
1456
1579
|
|
1457
|
-
|
1458
|
-
|
1459
|
-
this.
|
1460
|
-
this.
|
1580
|
+
this.trigger('message', reply);
|
1581
|
+
|
1582
|
+
if (this._state === this.UP) return;
|
1583
|
+
this._state = this.UP;
|
1584
|
+
this._client.trigger('transport:up');
|
1461
1585
|
},
|
1462
1586
|
|
1463
|
-
|
1464
|
-
|
1465
|
-
|
1466
|
-
|
1587
|
+
handleError: function(message, immediate) {
|
1588
|
+
var envelope = this._envelopes[message.id],
|
1589
|
+
request = envelope && envelope.request,
|
1590
|
+
self = this;
|
1591
|
+
|
1592
|
+
if (!request) return;
|
1593
|
+
|
1594
|
+
request.then(function(req) {
|
1595
|
+
if (req && req.abort) req.abort();
|
1596
|
+
});
|
1597
|
+
|
1598
|
+
var scheduler = envelope.scheduler;
|
1599
|
+
scheduler.fail();
|
1600
|
+
|
1601
|
+
Faye.ENV.clearTimeout(envelope.timer);
|
1602
|
+
envelope.request = envelope.timer = null;
|
1603
|
+
|
1604
|
+
if (immediate) {
|
1605
|
+
this._sendEnvelope(envelope);
|
1606
|
+
} else {
|
1607
|
+
envelope.timer = Faye.ENV.setTimeout(function() {
|
1608
|
+
envelope.timer = null;
|
1609
|
+
self._sendEnvelope(envelope);
|
1610
|
+
}, scheduler.getInterval() * 1000);
|
1467
1611
|
}
|
1468
|
-
|
1469
|
-
|
1612
|
+
|
1613
|
+
if (this._state === this.DOWN) return;
|
1614
|
+
this._state = this.DOWN;
|
1615
|
+
this._client.trigger('transport:down');
|
1470
1616
|
}
|
1471
1617
|
});
|
1472
1618
|
|
1473
|
-
Faye.extend(Faye.
|
1474
|
-
Faye.extend(Faye.
|
1475
|
-
|
1476
|
-
Faye.
|
1619
|
+
Faye.extend(Faye.Dispatcher.prototype, Faye.Publisher);
|
1620
|
+
Faye.extend(Faye.Dispatcher.prototype, Faye.Logging);
|
1621
|
+
|
1622
|
+
Faye.Scheduler = function(message, options) {
|
1623
|
+
this.message = message;
|
1624
|
+
this.options = options;
|
1625
|
+
this.attempts = 0;
|
1626
|
+
};
|
1627
|
+
|
1628
|
+
Faye.extend(Faye.Scheduler.prototype, {
|
1629
|
+
getTimeout: function() {
|
1630
|
+
return this.options.timeout;
|
1631
|
+
},
|
1632
|
+
|
1633
|
+
getInterval: function() {
|
1634
|
+
return this.options.interval;
|
1635
|
+
},
|
1636
|
+
|
1637
|
+
isDeliverable: function() {
|
1638
|
+
var attempts = this.options.attempts,
|
1639
|
+
made = this.attempts,
|
1640
|
+
deadline = this.options.deadline,
|
1641
|
+
now = new Date().getTime();
|
1642
|
+
|
1643
|
+
if (attempts !== undefined && made >= attempts)
|
1644
|
+
return false;
|
1645
|
+
|
1646
|
+
if (deadline !== undefined && now > deadline)
|
1647
|
+
return false;
|
1648
|
+
|
1649
|
+
return true;
|
1650
|
+
},
|
1651
|
+
|
1652
|
+
send: function() {
|
1653
|
+
this.attempts += 1;
|
1654
|
+
},
|
1655
|
+
|
1656
|
+
succeed: function() {},
|
1657
|
+
|
1658
|
+
fail: function() {},
|
1659
|
+
|
1660
|
+
abort: function() {}
|
1661
|
+
});
|
1477
1662
|
|
1478
1663
|
Faye.Transport = Faye.extend(Faye.Class({
|
1479
|
-
|
1664
|
+
DEFAULT_PORTS: {'http:': 80, 'https:': 443, 'ws:': 80, 'wss:': 443},
|
1665
|
+
SECURE_PROTOCOLS: ['https:', 'wss:'],
|
1666
|
+
MAX_DELAY: 0,
|
1667
|
+
|
1480
1668
|
batching: true,
|
1481
1669
|
|
1482
|
-
initialize: function(
|
1483
|
-
this.
|
1484
|
-
this.endpoint
|
1485
|
-
this._outbox
|
1670
|
+
initialize: function(dispatcher, endpoint) {
|
1671
|
+
this._dispatcher = dispatcher;
|
1672
|
+
this.endpoint = endpoint;
|
1673
|
+
this._outbox = [];
|
1674
|
+
this._proxy = Faye.extend({}, this._dispatcher.proxy);
|
1675
|
+
|
1676
|
+
if (!this._proxy.origin && Faye.NodeAdapter) {
|
1677
|
+
this._proxy.origin = Faye.indexOf(this.SECURE_PROTOCOLS, this.endpoint.protocol) >= 0
|
1678
|
+
? (process.env.HTTPS_PROXY || process.env.https_proxy)
|
1679
|
+
: (process.env.HTTP_PROXY || process.env.http_proxy);
|
1680
|
+
}
|
1486
1681
|
},
|
1487
1682
|
|
1488
1683
|
close: function() {},
|
1489
1684
|
|
1490
|
-
encode: function(
|
1685
|
+
encode: function(messages) {
|
1491
1686
|
return '';
|
1492
1687
|
},
|
1493
1688
|
|
1494
|
-
|
1495
|
-
var message = envelope.message;
|
1496
|
-
|
1689
|
+
sendMessage: function(message) {
|
1497
1690
|
this.debug('Client ? sending message to ?: ?',
|
1498
|
-
this.
|
1691
|
+
this._dispatcher.clientId, Faye.URI.stringify(this.endpoint), message);
|
1499
1692
|
|
1500
|
-
if (!this.batching) return this.request([
|
1693
|
+
if (!this.batching) return Faye.Promise.fulfilled(this.request([message]));
|
1501
1694
|
|
1502
|
-
this._outbox.push(
|
1695
|
+
this._outbox.push(message);
|
1696
|
+
this._flushLargeBatch();
|
1697
|
+
this._promise = this._promise || new Faye.Promise();
|
1503
1698
|
|
1504
|
-
if (message.channel === Faye.Channel.HANDSHAKE)
|
1505
|
-
|
1699
|
+
if (message.channel === Faye.Channel.HANDSHAKE) {
|
1700
|
+
this.addTimeout('publish', 0.01, this._flush, this);
|
1701
|
+
return this._promise;
|
1702
|
+
}
|
1506
1703
|
|
1507
1704
|
if (message.channel === Faye.Channel.CONNECT)
|
1508
1705
|
this._connectMessage = message;
|
1509
1706
|
|
1510
|
-
this.
|
1511
|
-
|
1707
|
+
this.addTimeout('publish', this.MAX_DELAY, this._flush, this);
|
1708
|
+
return this._promise;
|
1512
1709
|
},
|
1513
1710
|
|
1514
|
-
|
1711
|
+
_flush: function() {
|
1515
1712
|
this.removeTimeout('publish');
|
1516
1713
|
|
1517
1714
|
if (this._outbox.length > 1 && this._connectMessage)
|
1518
1715
|
this._connectMessage.advice = {timeout: 0};
|
1519
1716
|
|
1520
|
-
this.request(this._outbox);
|
1717
|
+
Faye.Promise.fulfill(this._promise, this.request(this._outbox));
|
1718
|
+
delete this._promise;
|
1521
1719
|
|
1522
1720
|
this._connectMessage = null;
|
1523
1721
|
this._outbox = [];
|
1524
1722
|
},
|
1525
1723
|
|
1526
|
-
|
1724
|
+
_flushLargeBatch: function() {
|
1527
1725
|
var string = this.encode(this._outbox);
|
1528
|
-
if (string.length < this.
|
1726
|
+
if (string.length < this._dispatcher.maxRequestSize) return;
|
1529
1727
|
var last = this._outbox.pop();
|
1530
|
-
this.
|
1728
|
+
this._flush();
|
1531
1729
|
if (last) this._outbox.push(last);
|
1532
1730
|
},
|
1533
1731
|
|
1534
|
-
|
1535
|
-
|
1536
|
-
while (n--) envelopes[n].setDeferredStatus('succeeded');
|
1537
|
-
|
1538
|
-
responses = [].concat(responses);
|
1732
|
+
_receive: function(replies) {
|
1733
|
+
replies = [].concat(replies);
|
1539
1734
|
|
1540
|
-
this.debug('Client ? received from ?: ?',
|
1541
|
-
this.
|
1735
|
+
this.debug('Client ? received from ? via ?: ?',
|
1736
|
+
this._dispatcher.clientId, Faye.URI.stringify(this.endpoint), this.connectionType, replies);
|
1542
1737
|
|
1543
|
-
for (var i = 0, n =
|
1544
|
-
this.
|
1738
|
+
for (var i = 0, n = replies.length; i < n; i++)
|
1739
|
+
this._dispatcher.handleResponse(replies[i]);
|
1545
1740
|
},
|
1546
1741
|
|
1547
|
-
|
1548
|
-
|
1549
|
-
|
1742
|
+
_handleError: function(messages, immediate) {
|
1743
|
+
messages = [].concat(messages);
|
1744
|
+
|
1745
|
+
this.debug('Client ? failed to send to ? via ?: ?',
|
1746
|
+
this._dispatcher.clientId, Faye.URI.stringify(this.endpoint), this.connectionType, messages);
|
1747
|
+
|
1748
|
+
for (var i = 0, n = messages.length; i < n; i++)
|
1749
|
+
this._dispatcher.handleError(messages[i]);
|
1550
1750
|
},
|
1551
1751
|
|
1552
1752
|
_getCookies: function() {
|
1553
|
-
var cookies = this.
|
1753
|
+
var cookies = this._dispatcher.cookies,
|
1754
|
+
url = Faye.URI.stringify(this.endpoint);
|
1755
|
+
|
1554
1756
|
if (!cookies) return '';
|
1555
1757
|
|
1556
|
-
return cookies.
|
1557
|
-
|
1558
|
-
|
1559
|
-
secure: this.endpoint.protocol === 'https:'
|
1560
|
-
}).toValueString();
|
1758
|
+
return Faye.map(cookies.getCookiesSync(url), function(cookie) {
|
1759
|
+
return cookie.cookieString();
|
1760
|
+
}).join('; ');
|
1561
1761
|
},
|
1562
1762
|
|
1563
1763
|
_storeCookies: function(setCookie) {
|
1564
|
-
|
1764
|
+
var cookies = this._dispatcher.cookies,
|
1765
|
+
url = Faye.URI.stringify(this.endpoint),
|
1766
|
+
cookie;
|
1767
|
+
|
1768
|
+
if (!setCookie || !cookies) return;
|
1565
1769
|
setCookie = [].concat(setCookie);
|
1566
|
-
var cookie;
|
1567
1770
|
|
1568
1771
|
for (var i = 0, n = setCookie.length; i < n; i++) {
|
1569
|
-
cookie =
|
1570
|
-
cookie
|
1571
|
-
cookie.domain = cookie.domain || this.endpoint.hostname;
|
1772
|
+
cookie = Faye.Cookies.Cookie.parse(setCookie[i]);
|
1773
|
+
cookies.setCookieSync(cookie, url);
|
1572
1774
|
}
|
1573
1775
|
}
|
1574
1776
|
|
1575
1777
|
}), {
|
1576
|
-
get: function(
|
1577
|
-
var endpoint =
|
1778
|
+
get: function(dispatcher, allowed, disabled, callback, context) {
|
1779
|
+
var endpoint = dispatcher.endpoint;
|
1578
1780
|
|
1579
1781
|
Faye.asyncEach(this._transports, function(pair, resume) {
|
1580
1782
|
var connType = pair[0], klass = pair[1],
|
1581
|
-
connEndpoint =
|
1783
|
+
connEndpoint = dispatcher.endpointFor(connType);
|
1582
1784
|
|
1583
1785
|
if (Faye.indexOf(disabled, connType) >= 0)
|
1584
1786
|
return resume();
|
1585
1787
|
|
1586
1788
|
if (Faye.indexOf(allowed, connType) < 0) {
|
1587
|
-
klass.isUsable(
|
1789
|
+
klass.isUsable(dispatcher, connEndpoint, function() {});
|
1588
1790
|
return resume();
|
1589
1791
|
}
|
1590
1792
|
|
1591
|
-
klass.isUsable(
|
1793
|
+
klass.isUsable(dispatcher, connEndpoint, function(isUsable) {
|
1592
1794
|
if (!isUsable) return resume();
|
1593
|
-
var transport = klass.hasOwnProperty('create') ? klass.create(
|
1795
|
+
var transport = klass.hasOwnProperty('create') ? klass.create(dispatcher, connEndpoint) : new klass(dispatcher, connEndpoint);
|
1594
1796
|
callback.call(context, transport);
|
1595
1797
|
});
|
1596
1798
|
}, function() {
|
@@ -1603,6 +1805,10 @@ Faye.Transport = Faye.extend(Faye.Class({
|
|
1603
1805
|
klass.prototype.connectionType = type;
|
1604
1806
|
},
|
1605
1807
|
|
1808
|
+
getConnectionTypes: function() {
|
1809
|
+
return Faye.map(this._transports, function(t) { return t[0] });
|
1810
|
+
},
|
1811
|
+
|
1606
1812
|
_transports: []
|
1607
1813
|
});
|
1608
1814
|
|
@@ -2154,16 +2360,23 @@ Faye.Transport.WebSocket = Faye.extend(Faye.Class(Faye.Transport, {
|
|
2154
2360
|
this.connect();
|
2155
2361
|
},
|
2156
2362
|
|
2157
|
-
request: function(
|
2363
|
+
request: function(messages) {
|
2158
2364
|
this._pending = this._pending || new Faye.Set();
|
2159
|
-
for (var i = 0, n =
|
2365
|
+
for (var i = 0, n = messages.length; i < n; i++) this._pending.add(messages[i]);
|
2366
|
+
|
2367
|
+
var promise = new Faye.Promise();
|
2160
2368
|
|
2161
2369
|
this.callback(function(socket) {
|
2162
2370
|
if (!socket) return;
|
2163
|
-
var messages = Faye.map(envelopes, function(e) { return e.message });
|
2164
2371
|
socket.send(Faye.toJSON(messages));
|
2372
|
+
Faye.Promise.fulfill(promise, socket);
|
2165
2373
|
}, this);
|
2374
|
+
|
2166
2375
|
this.connect();
|
2376
|
+
|
2377
|
+
return {
|
2378
|
+
abort: function() { promise.then(function(ws) { ws.close() }) }
|
2379
|
+
};
|
2167
2380
|
},
|
2168
2381
|
|
2169
2382
|
connect: function() {
|
@@ -2204,28 +2417,25 @@ Faye.Transport.WebSocket = Faye.extend(Faye.Class(Faye.Transport, {
|
|
2204
2417
|
delete self._pending;
|
2205
2418
|
|
2206
2419
|
if (wasConnected) {
|
2207
|
-
self.
|
2420
|
+
self._handleError(pending, true);
|
2208
2421
|
} else if (self._everConnected) {
|
2209
|
-
self.
|
2422
|
+
self._handleError(pending);
|
2210
2423
|
} else {
|
2211
2424
|
self.setDeferredStatus('failed');
|
2212
2425
|
}
|
2213
2426
|
};
|
2214
2427
|
|
2215
2428
|
socket.onmessage = function(event) {
|
2216
|
-
var
|
2217
|
-
|
2218
|
-
envelope;
|
2429
|
+
var replies = JSON.parse(event.data);
|
2430
|
+
if (!replies) return;
|
2219
2431
|
|
2220
|
-
|
2221
|
-
messages = [].concat(messages);
|
2432
|
+
replies = [].concat(replies);
|
2222
2433
|
|
2223
|
-
for (var i = 0, n =
|
2224
|
-
if (
|
2225
|
-
|
2226
|
-
if (envelope) envelopes.push(envelope);
|
2434
|
+
for (var i = 0, n = replies.length; i < n; i++) {
|
2435
|
+
if (replies[i].successful === undefined) continue;
|
2436
|
+
self._pending.remove(replies[i]);
|
2227
2437
|
}
|
2228
|
-
self.
|
2438
|
+
self._receive(replies);
|
2229
2439
|
};
|
2230
2440
|
},
|
2231
2441
|
|
@@ -2235,10 +2445,14 @@ Faye.Transport.WebSocket = Faye.extend(Faye.Class(Faye.Transport, {
|
|
2235
2445
|
},
|
2236
2446
|
|
2237
2447
|
_createSocket: function() {
|
2238
|
-
var url
|
2239
|
-
|
2448
|
+
var url = Faye.Transport.WebSocket.getSocketUrl(this.endpoint),
|
2449
|
+
headers = this._dispatcher.headers,
|
2450
|
+
extensions = this._dispatcher.wsExtensions,
|
2451
|
+
cookie = this._getCookies(),
|
2452
|
+
tls = this._dispatcher.tls,
|
2453
|
+
options = {extensions: extensions, headers: headers, proxy: this._proxy, tls: tls};
|
2240
2454
|
|
2241
|
-
options.headers['Cookie'] =
|
2455
|
+
if (cookie !== '') options.headers['Cookie'] = cookie;
|
2242
2456
|
|
2243
2457
|
if (Faye.WebSocket) return new Faye.WebSocket.Client(url, [], options);
|
2244
2458
|
if (Faye.ENV.MozWebSocket) return new MozWebSocket(url);
|
@@ -2248,7 +2462,7 @@ Faye.Transport.WebSocket = Faye.extend(Faye.Class(Faye.Transport, {
|
|
2248
2462
|
_ping: function() {
|
2249
2463
|
if (!this._socket) return;
|
2250
2464
|
this._socket.send('[]');
|
2251
|
-
this.addTimeout('ping', this.
|
2465
|
+
this.addTimeout('ping', this._dispatcher.timeout / 2, this._ping, this);
|
2252
2466
|
}
|
2253
2467
|
|
2254
2468
|
}), {
|
@@ -2257,9 +2471,9 @@ Faye.Transport.WebSocket = Faye.extend(Faye.Class(Faye.Transport, {
|
|
2257
2471
|
'https:': 'wss:'
|
2258
2472
|
},
|
2259
2473
|
|
2260
|
-
create: function(
|
2261
|
-
var sockets =
|
2262
|
-
sockets[endpoint.href] = sockets[endpoint.href] || new this(
|
2474
|
+
create: function(dispatcher, endpoint) {
|
2475
|
+
var sockets = dispatcher.transports.websocket = dispatcher.transports.websocket || {};
|
2476
|
+
sockets[endpoint.href] = sockets[endpoint.href] || new this(dispatcher, endpoint);
|
2263
2477
|
return sockets[endpoint.href];
|
2264
2478
|
},
|
2265
2479
|
|
@@ -2269,28 +2483,28 @@ Faye.Transport.WebSocket = Faye.extend(Faye.Class(Faye.Transport, {
|
|
2269
2483
|
return Faye.URI.stringify(endpoint);
|
2270
2484
|
},
|
2271
2485
|
|
2272
|
-
isUsable: function(
|
2273
|
-
this.create(
|
2486
|
+
isUsable: function(dispatcher, endpoint, callback, context) {
|
2487
|
+
this.create(dispatcher, endpoint).isUsable(callback, context);
|
2274
2488
|
}
|
2275
2489
|
});
|
2276
2490
|
|
2277
2491
|
Faye.extend(Faye.Transport.WebSocket.prototype, Faye.Deferrable);
|
2278
2492
|
Faye.Transport.register('websocket', Faye.Transport.WebSocket);
|
2279
2493
|
|
2280
|
-
if (Faye.Event)
|
2494
|
+
if (Faye.Event && Faye.ENV.onbeforeunload !== undefined)
|
2281
2495
|
Faye.Event.on(Faye.ENV, 'beforeunload', function() {
|
2282
2496
|
Faye.Transport.WebSocket._unloaded = true;
|
2283
2497
|
});
|
2284
2498
|
|
2285
2499
|
Faye.Transport.EventSource = Faye.extend(Faye.Class(Faye.Transport, {
|
2286
|
-
initialize: function(
|
2287
|
-
Faye.Transport.prototype.initialize.call(this,
|
2500
|
+
initialize: function(dispatcher, endpoint) {
|
2501
|
+
Faye.Transport.prototype.initialize.call(this, dispatcher, endpoint);
|
2288
2502
|
if (!Faye.ENV.EventSource) return this.setDeferredStatus('failed');
|
2289
2503
|
|
2290
|
-
this._xhr = new Faye.Transport.XHR(
|
2504
|
+
this._xhr = new Faye.Transport.XHR(dispatcher, endpoint);
|
2291
2505
|
|
2292
2506
|
endpoint = Faye.copyObject(endpoint);
|
2293
|
-
endpoint.pathname += '/' +
|
2507
|
+
endpoint.pathname += '/' + dispatcher.clientId;
|
2294
2508
|
|
2295
2509
|
var socket = new EventSource(Faye.URI.stringify(endpoint)),
|
2296
2510
|
self = this;
|
@@ -2302,7 +2516,7 @@ Faye.Transport.EventSource = Faye.extend(Faye.Class(Faye.Transport, {
|
|
2302
2516
|
|
2303
2517
|
socket.onerror = function() {
|
2304
2518
|
if (self._everConnected) {
|
2305
|
-
self.
|
2519
|
+
self._handleError([]);
|
2306
2520
|
} else {
|
2307
2521
|
self.setDeferredStatus('failed');
|
2308
2522
|
socket.close();
|
@@ -2310,7 +2524,7 @@ Faye.Transport.EventSource = Faye.extend(Faye.Class(Faye.Transport, {
|
|
2310
2524
|
};
|
2311
2525
|
|
2312
2526
|
socket.onmessage = function(event) {
|
2313
|
-
self.
|
2527
|
+
self._receive(JSON.parse(event.data));
|
2314
2528
|
};
|
2315
2529
|
|
2316
2530
|
this._socket = socket;
|
@@ -2328,34 +2542,34 @@ Faye.Transport.EventSource = Faye.extend(Faye.Class(Faye.Transport, {
|
|
2328
2542
|
this.errback(function() { callback.call(context, false) });
|
2329
2543
|
},
|
2330
2544
|
|
2331
|
-
encode: function(
|
2332
|
-
return this._xhr.encode(
|
2545
|
+
encode: function(messages) {
|
2546
|
+
return this._xhr.encode(messages);
|
2333
2547
|
},
|
2334
2548
|
|
2335
|
-
request: function(
|
2336
|
-
this._xhr.request(
|
2549
|
+
request: function(messages) {
|
2550
|
+
return this._xhr.request(messages);
|
2337
2551
|
}
|
2338
2552
|
|
2339
2553
|
}), {
|
2340
|
-
isUsable: function(
|
2341
|
-
var id =
|
2554
|
+
isUsable: function(dispatcher, endpoint, callback, context) {
|
2555
|
+
var id = dispatcher.clientId;
|
2342
2556
|
if (!id) return callback.call(context, false);
|
2343
2557
|
|
2344
|
-
Faye.Transport.XHR.isUsable(
|
2558
|
+
Faye.Transport.XHR.isUsable(dispatcher, endpoint, function(usable) {
|
2345
2559
|
if (!usable) return callback.call(context, false);
|
2346
|
-
this.create(
|
2560
|
+
this.create(dispatcher, endpoint).isUsable(callback, context);
|
2347
2561
|
}, this);
|
2348
2562
|
},
|
2349
2563
|
|
2350
|
-
create: function(
|
2351
|
-
var sockets =
|
2352
|
-
id =
|
2564
|
+
create: function(dispatcher, endpoint) {
|
2565
|
+
var sockets = dispatcher.transports.eventsource = dispatcher.transports.eventsource || {},
|
2566
|
+
id = dispatcher.clientId;
|
2353
2567
|
|
2354
2568
|
endpoint = Faye.copyObject(endpoint);
|
2355
2569
|
endpoint.pathname += '/' + (id || '');
|
2356
2570
|
var url = Faye.URI.stringify(endpoint);
|
2357
2571
|
|
2358
|
-
sockets[url] = sockets[url] || new this(
|
2572
|
+
sockets[url] = sockets[url] || new this(dispatcher, endpoint);
|
2359
2573
|
return sockets[url];
|
2360
2574
|
}
|
2361
2575
|
});
|
@@ -2364,58 +2578,58 @@ Faye.extend(Faye.Transport.EventSource.prototype, Faye.Deferrable);
|
|
2364
2578
|
Faye.Transport.register('eventsource', Faye.Transport.EventSource);
|
2365
2579
|
|
2366
2580
|
Faye.Transport.XHR = Faye.extend(Faye.Class(Faye.Transport, {
|
2367
|
-
encode: function(
|
2368
|
-
var messages = Faye.map(envelopes, function(e) { return e.message });
|
2581
|
+
encode: function(messages) {
|
2369
2582
|
return Faye.toJSON(messages);
|
2370
2583
|
},
|
2371
2584
|
|
2372
|
-
request: function(
|
2373
|
-
var
|
2585
|
+
request: function(messages) {
|
2586
|
+
var href = this.endpoint.href,
|
2374
2587
|
xhr = Faye.ENV.ActiveXObject ? new ActiveXObject('Microsoft.XMLHTTP') : new XMLHttpRequest(),
|
2375
2588
|
self = this;
|
2376
2589
|
|
2377
|
-
xhr.open('POST',
|
2590
|
+
xhr.open('POST', href, true);
|
2378
2591
|
xhr.setRequestHeader('Content-Type', 'application/json');
|
2379
2592
|
xhr.setRequestHeader('Pragma', 'no-cache');
|
2380
2593
|
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
|
2381
2594
|
|
2382
|
-
var headers = this.
|
2595
|
+
var headers = this._dispatcher.headers;
|
2383
2596
|
for (var key in headers) {
|
2384
2597
|
if (!headers.hasOwnProperty(key)) continue;
|
2385
2598
|
xhr.setRequestHeader(key, headers[key]);
|
2386
2599
|
}
|
2387
2600
|
|
2388
2601
|
var abort = function() { xhr.abort() };
|
2389
|
-
Faye.Event.on(Faye.ENV, 'beforeunload', abort);
|
2602
|
+
if (Faye.ENV.onbeforeunload !== undefined) Faye.Event.on(Faye.ENV, 'beforeunload', abort);
|
2390
2603
|
|
2391
2604
|
xhr.onreadystatechange = function() {
|
2392
2605
|
if (!xhr || xhr.readyState !== 4) return;
|
2393
2606
|
|
2394
|
-
var
|
2395
|
-
status
|
2396
|
-
text
|
2397
|
-
successful
|
2607
|
+
var replies = null,
|
2608
|
+
status = xhr.status,
|
2609
|
+
text = xhr.responseText,
|
2610
|
+
successful = (status >= 200 && status < 300) || status === 304 || status === 1223;
|
2398
2611
|
|
2399
|
-
Faye.Event.detach(Faye.ENV, 'beforeunload', abort);
|
2612
|
+
if (Faye.ENV.onbeforeunload !== undefined) Faye.Event.detach(Faye.ENV, 'beforeunload', abort);
|
2400
2613
|
xhr.onreadystatechange = function() {};
|
2401
2614
|
xhr = null;
|
2402
2615
|
|
2403
|
-
if (!successful) return self.
|
2616
|
+
if (!successful) return self._handleError(messages);
|
2404
2617
|
|
2405
2618
|
try {
|
2406
|
-
|
2619
|
+
replies = JSON.parse(text);
|
2407
2620
|
} catch (e) {}
|
2408
2621
|
|
2409
|
-
if (
|
2410
|
-
self.
|
2622
|
+
if (replies)
|
2623
|
+
self._receive(replies);
|
2411
2624
|
else
|
2412
|
-
self.
|
2625
|
+
self._handleError(messages);
|
2413
2626
|
};
|
2414
2627
|
|
2415
|
-
xhr.send(this.encode(
|
2628
|
+
xhr.send(this.encode(messages));
|
2629
|
+
return xhr;
|
2416
2630
|
}
|
2417
2631
|
}), {
|
2418
|
-
isUsable: function(
|
2632
|
+
isUsable: function(dispatcher, endpoint, callback, context) {
|
2419
2633
|
callback.call(context, Faye.URI.isSameOrigin(endpoint));
|
2420
2634
|
}
|
2421
2635
|
});
|
@@ -2423,15 +2637,14 @@ Faye.Transport.XHR = Faye.extend(Faye.Class(Faye.Transport, {
|
|
2423
2637
|
Faye.Transport.register('long-polling', Faye.Transport.XHR);
|
2424
2638
|
|
2425
2639
|
Faye.Transport.CORS = Faye.extend(Faye.Class(Faye.Transport, {
|
2426
|
-
encode: function(
|
2427
|
-
var messages = Faye.map(envelopes, function(e) { return e.message });
|
2640
|
+
encode: function(messages) {
|
2428
2641
|
return 'message=' + encodeURIComponent(Faye.toJSON(messages));
|
2429
2642
|
},
|
2430
2643
|
|
2431
|
-
request: function(
|
2644
|
+
request: function(messages) {
|
2432
2645
|
var xhrClass = Faye.ENV.XDomainRequest ? XDomainRequest : XMLHttpRequest,
|
2433
2646
|
xhr = new xhrClass(),
|
2434
|
-
headers = this.
|
2647
|
+
headers = this._dispatcher.headers,
|
2435
2648
|
self = this,
|
2436
2649
|
key;
|
2437
2650
|
|
@@ -2452,29 +2665,30 @@ Faye.Transport.CORS = Faye.extend(Faye.Class(Faye.Transport, {
|
|
2452
2665
|
};
|
2453
2666
|
|
2454
2667
|
xhr.onload = function() {
|
2455
|
-
var
|
2668
|
+
var replies = null;
|
2456
2669
|
try {
|
2457
|
-
|
2670
|
+
replies = JSON.parse(xhr.responseText);
|
2458
2671
|
} catch (e) {}
|
2459
2672
|
|
2460
2673
|
cleanUp();
|
2461
2674
|
|
2462
|
-
if (
|
2463
|
-
self.
|
2675
|
+
if (replies)
|
2676
|
+
self._receive(replies);
|
2464
2677
|
else
|
2465
|
-
self.
|
2678
|
+
self._handleError(messages);
|
2466
2679
|
};
|
2467
2680
|
|
2468
2681
|
xhr.onerror = xhr.ontimeout = function() {
|
2469
2682
|
cleanUp();
|
2470
|
-
self.
|
2683
|
+
self._handleError(messages);
|
2471
2684
|
};
|
2472
2685
|
|
2473
2686
|
xhr.onprogress = function() {};
|
2474
|
-
xhr.send(this.encode(
|
2687
|
+
xhr.send(this.encode(messages));
|
2688
|
+
return xhr;
|
2475
2689
|
}
|
2476
2690
|
}), {
|
2477
|
-
isUsable: function(
|
2691
|
+
isUsable: function(dispatcher, endpoint, callback, context) {
|
2478
2692
|
if (Faye.URI.isSameOrigin(endpoint))
|
2479
2693
|
return callback.call(context, false);
|
2480
2694
|
|
@@ -2492,17 +2706,15 @@ Faye.Transport.CORS = Faye.extend(Faye.Class(Faye.Transport, {
|
|
2492
2706
|
Faye.Transport.register('cross-origin-long-polling', Faye.Transport.CORS);
|
2493
2707
|
|
2494
2708
|
Faye.Transport.JSONP = Faye.extend(Faye.Class(Faye.Transport, {
|
2495
|
-
encode: function(
|
2496
|
-
var messages = Faye.map(envelopes, function(e) { return e.message });
|
2709
|
+
encode: function(messages) {
|
2497
2710
|
var url = Faye.copyObject(this.endpoint);
|
2498
2711
|
url.query.message = Faye.toJSON(messages);
|
2499
2712
|
url.query.jsonp = '__jsonp' + Faye.Transport.JSONP._cbCount + '__';
|
2500
2713
|
return Faye.URI.stringify(url);
|
2501
2714
|
},
|
2502
2715
|
|
2503
|
-
request: function(
|
2504
|
-
var
|
2505
|
-
head = document.getElementsByTagName('head')[0],
|
2716
|
+
request: function(messages) {
|
2717
|
+
var head = document.getElementsByTagName('head')[0],
|
2506
2718
|
script = document.createElement('script'),
|
2507
2719
|
callbackName = Faye.Transport.JSONP.getCallbackName(),
|
2508
2720
|
endpoint = Faye.copyObject(this.endpoint),
|
@@ -2511,17 +2723,28 @@ Faye.Transport.JSONP = Faye.extend(Faye.Class(Faye.Transport, {
|
|
2511
2723
|
endpoint.query.message = Faye.toJSON(messages);
|
2512
2724
|
endpoint.query.jsonp = callbackName;
|
2513
2725
|
|
2514
|
-
|
2726
|
+
var cleanup = function() {
|
2515
2727
|
if (!Faye.ENV[callbackName]) return false;
|
2516
2728
|
Faye.ENV[callbackName] = undefined;
|
2517
2729
|
try { delete Faye.ENV[callbackName] } catch (e) {}
|
2518
2730
|
script.parentNode.removeChild(script);
|
2519
|
-
|
2731
|
+
};
|
2732
|
+
|
2733
|
+
Faye.ENV[callbackName] = function(replies) {
|
2734
|
+
cleanup();
|
2735
|
+
self._receive(replies);
|
2520
2736
|
};
|
2521
2737
|
|
2522
2738
|
script.type = 'text/javascript';
|
2523
2739
|
script.src = Faye.URI.stringify(endpoint);
|
2524
2740
|
head.appendChild(script);
|
2741
|
+
|
2742
|
+
script.onerror = function() {
|
2743
|
+
cleanup();
|
2744
|
+
self._handleError(messages);
|
2745
|
+
};
|
2746
|
+
|
2747
|
+
return {abort: cleanup};
|
2525
2748
|
}
|
2526
2749
|
}), {
|
2527
2750
|
_cbCount: 0,
|
@@ -2531,7 +2754,7 @@ Faye.Transport.JSONP = Faye.extend(Faye.Class(Faye.Transport, {
|
|
2531
2754
|
return '__jsonp' + this._cbCount + '__';
|
2532
2755
|
},
|
2533
2756
|
|
2534
|
-
isUsable: function(
|
2757
|
+
isUsable: function(dispatcher, endpoint, callback, context) {
|
2535
2758
|
callback.call(context, true);
|
2536
2759
|
}
|
2537
2760
|
});
|