faye 0.8.3 → 0.8.4
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of faye might be problematic. Click here for more details.
- data/History.txt +12 -0
- data/lib/faye/adapters/rack_adapter.rb +5 -5
- data/lib/faye/engines/proxy.rb +9 -5
- data/lib/faye/protocol/client.rb +4 -1
- data/lib/faye/transport/http.rb +1 -1
- data/lib/faye/transport/local.rb +1 -1
- data/lib/faye/transport/transport.rb +13 -13
- data/lib/faye/transport/web_socket.rb +17 -28
- data/lib/faye-browser-min.js +1 -1
- data/lib/faye-browser-min.js.map +2 -2
- data/lib/faye-browser.js +129 -78
- data/lib/faye.rb +1 -1
- data/spec/javascript/faye_spec.js +1 -1
- data/spec/javascript/node_adapter_spec.js +1 -1
- data/spec/javascript/transport_spec.js +1 -1
- data/spec/ruby/client_spec.rb +1 -1
- data/spec/ruby/faye_spec.rb +1 -1
- data/spec/ruby/rack_adapter_spec.rb +14 -14
- data/spec/ruby/transport_spec.rb +5 -4
- metadata +2 -2
data/History.txt
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
=== 0.8.4 / 2012-09-29
|
2
|
+
|
3
|
+
* Optimise upgrade process so that WebSocket is tested earlier and the connection is cached
|
4
|
+
* Check that EventSource actually works to work around broken Opera implementation
|
5
|
+
* Emit 'connection:open' and 'connection:close' events from the Engine proxy
|
6
|
+
* Increase size of client IDs from 128 to 160 bits
|
7
|
+
* Fix bug with relative URL resolution in IE
|
8
|
+
* Limit the JSON-P transport's message buffer so it doesn't create over-long URLs
|
9
|
+
* Send 'Pragma: no-cache' with XHR requests to guard against iOS 6 POST caching
|
10
|
+
* Add 'charset=utf-8' to response Content-Type headers
|
11
|
+
|
12
|
+
|
1
13
|
=== 0.8.3 / 2012-07-15
|
2
14
|
|
3
15
|
* Client#subscribe returns an array of Subscriptions if given an array of channels
|
@@ -11,9 +11,9 @@ module Faye
|
|
11
11
|
DEFAULT_ENDPOINT = '/bayeux'
|
12
12
|
SCRIPT_PATH = 'faye-browser-min.js'
|
13
13
|
|
14
|
-
TYPE_JSON = {'Content-Type' => 'application/json'}
|
15
|
-
TYPE_SCRIPT = {'Content-Type' => 'text/javascript'}
|
16
|
-
TYPE_TEXT = {'Content-Type' => 'text/plain'}
|
14
|
+
TYPE_JSON = {'Content-Type' => 'application/json; charset=utf-8'}
|
15
|
+
TYPE_SCRIPT = {'Content-Type' => 'text/javascript; charset=utf-8'}
|
16
|
+
TYPE_TEXT = {'Content-Type' => 'text/plain; charset=utf-8'}
|
17
17
|
|
18
18
|
# This header is passed by Rack::Proxy during testing. Rack::Proxy seems to
|
19
19
|
# set content-length for you, and setting it in here really slows the tests
|
@@ -110,7 +110,7 @@ module Faye
|
|
110
110
|
@server.flush_connection(message) if request.get?
|
111
111
|
|
112
112
|
headers['Access-Control-Allow-Origin'] = origin if origin
|
113
|
-
headers['Cache-Control'] = 'no-cache, no-store'
|
113
|
+
headers['Cache-Control'] = 'no-cache, no-store'
|
114
114
|
|
115
115
|
@server.process(message, false) do |replies|
|
116
116
|
response = Faye.to_json(replies)
|
@@ -204,7 +204,7 @@ module Faye
|
|
204
204
|
'Access-Control-Allow-Credentials' => 'false',
|
205
205
|
'Access-Control-Max-Age' => '86400',
|
206
206
|
'Access-Control-Allow-Methods' => 'POST, GET, PUT, DELETE, OPTIONS',
|
207
|
-
'Access-Control-Allow-Headers' => 'Accept, Content-Type, X-Requested-With'
|
207
|
+
'Access-Control-Allow-Headers' => 'Accept, Content-Type, Pragma, X-Requested-With'
|
208
208
|
}
|
209
209
|
[200, headers, ['']]
|
210
210
|
end
|
data/lib/faye/engines/proxy.rb
CHANGED
@@ -5,14 +5,14 @@ module Faye
|
|
5
5
|
MAX_DELAY = 0.0
|
6
6
|
INTERVAL = 0.0
|
7
7
|
TIMEOUT = 60.0
|
8
|
-
ID_LENGTH =
|
8
|
+
ID_LENGTH = 160
|
9
9
|
|
10
10
|
autoload :Connection, File.expand_path('../connection', __FILE__)
|
11
11
|
autoload :Memory, File.expand_path('../memory', __FILE__)
|
12
12
|
|
13
13
|
def self.ensure_reactor_running!
|
14
|
-
Thread.new {
|
15
|
-
Thread.pass until
|
14
|
+
Thread.new { EventMachine.run } unless EventMachine.reactor_running?
|
15
|
+
Thread.pass until EventMachine.reactor_running?
|
16
16
|
end
|
17
17
|
|
18
18
|
def self.get(options)
|
@@ -46,7 +46,7 @@ module Faye
|
|
46
46
|
@engine = engine_class.create(self, @options)
|
47
47
|
|
48
48
|
bind :disconnect do |client_id|
|
49
|
-
|
49
|
+
EventMachine.next_tick { close_connection(client_id) }
|
50
50
|
end
|
51
51
|
|
52
52
|
debug 'Created new engine: ?', @options
|
@@ -68,12 +68,16 @@ module Faye
|
|
68
68
|
conn = @connections[client_id]
|
69
69
|
return conn if conn or not create
|
70
70
|
@connections[client_id] = Connection.new(self, client_id)
|
71
|
+
trigger('connection:open', client_id)
|
72
|
+
@connections[client_id]
|
71
73
|
end
|
72
74
|
|
73
75
|
def close_connection(client_id)
|
74
76
|
debug 'Closing connection for ?', client_id
|
75
77
|
conn = @connections[client_id]
|
76
|
-
|
78
|
+
return unless conn
|
79
|
+
conn.socket.close if conn.socket
|
80
|
+
trigger('connection:close', client_id)
|
77
81
|
@connections.delete(client_id)
|
78
82
|
end
|
79
83
|
|
data/lib/faye/protocol/client.rb
CHANGED
@@ -18,7 +18,7 @@ module Faye
|
|
18
18
|
CONNECTION_TIMEOUT = 60.0
|
19
19
|
DEFAULT_RETRY = 5.0
|
20
20
|
|
21
|
-
attr_reader :endpoint, :endpoints, :
|
21
|
+
attr_reader :client_id, :endpoint, :endpoints, :retry, :transports
|
22
22
|
|
23
23
|
def initialize(endpoint = nil, options = {})
|
24
24
|
info('New client created for ?', endpoint)
|
@@ -26,6 +26,7 @@ module Faye
|
|
26
26
|
@options = options
|
27
27
|
@endpoint = endpoint || RackAdapter::DEFAULT_ENDPOINT
|
28
28
|
@endpoints = @options[:endpoints] || {}
|
29
|
+
@transports = {}
|
29
30
|
@cookies = CookieJar::Jar.new
|
30
31
|
@headers = {}
|
31
32
|
@disabled = []
|
@@ -308,6 +309,8 @@ module Faye
|
|
308
309
|
|
309
310
|
def select_transport(transport_types)
|
310
311
|
Transport.get(self, transport_types) do |transport|
|
312
|
+
debug('Selected ? transport for ?', transport.connection_type, transport.endpoint)
|
313
|
+
|
311
314
|
@transport = transport
|
312
315
|
@transport.cookies = @cookies
|
313
316
|
@transport.headers = @headers
|
data/lib/faye/transport/http.rb
CHANGED
data/lib/faye/transport/local.rb
CHANGED
@@ -5,10 +5,9 @@ module Faye
|
|
5
5
|
include Publisher
|
6
6
|
include Timeouts
|
7
7
|
|
8
|
-
attr_accessor :cookies, :headers
|
8
|
+
attr_accessor :cookies, :endpoint, :headers
|
9
9
|
|
10
10
|
def initialize(client, endpoint)
|
11
|
-
debug('Created new ? transport for ?', connection_type, endpoint)
|
12
11
|
@client = client
|
13
12
|
@endpoint = endpoint
|
14
13
|
@outbox = []
|
@@ -33,7 +32,9 @@ module Faye
|
|
33
32
|
@outbox << message
|
34
33
|
@timeout = timeout
|
35
34
|
|
36
|
-
|
35
|
+
if message['channel'] == Channel::HANDSHAKE
|
36
|
+
return add_timeout(:publish, 0.01) { flush }
|
37
|
+
end
|
37
38
|
|
38
39
|
if message['channel'] == Channel::CONNECT
|
39
40
|
@connection_message = message
|
@@ -77,16 +78,15 @@ module Faye
|
|
77
78
|
|
78
79
|
select = lambda do |(conn_type, klass), resume|
|
79
80
|
conn_endpoint = client.endpoints[conn_type] || endpoint
|
80
|
-
|
81
|
-
klass.usable?(conn_endpoint)
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
resume.call
|
81
|
+
unless connection_types.include?(conn_type)
|
82
|
+
klass.usable?(client, conn_endpoint) { |u| }
|
83
|
+
next resume.call
|
84
|
+
end
|
85
|
+
|
86
|
+
klass.usable?(client, conn_endpoint) do |is_usable|
|
87
|
+
next resume.call unless is_usable
|
88
|
+
transport = klass.respond_to?(:create) ? klass.create(client, conn_endpoint) : klass.new(client, conn_endpoint)
|
89
|
+
callback.call(transport)
|
90
90
|
end
|
91
91
|
end
|
92
92
|
|
@@ -1,50 +1,36 @@
|
|
1
1
|
module Faye
|
2
2
|
|
3
3
|
class Transport::WebSocket < Transport
|
4
|
-
WEBSOCKET_TIMEOUT = 1
|
5
|
-
|
6
4
|
UNCONNECTED = 1
|
7
5
|
CONNECTING = 2
|
8
6
|
CONNECTED = 3
|
9
7
|
|
10
8
|
include EventMachine::Deferrable
|
11
9
|
|
12
|
-
def self.usable?(endpoint, &callback)
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
connected = true
|
20
|
-
socket.close
|
21
|
-
callback.call(true)
|
22
|
-
called = true
|
23
|
-
socket = nil
|
24
|
-
end
|
25
|
-
|
26
|
-
notconnected = lambda do |*args|
|
27
|
-
callback.call(false) unless called or connected
|
28
|
-
called = true
|
29
|
-
end
|
30
|
-
|
31
|
-
socket.onclose = socket.onerror = notconnected
|
32
|
-
EventMachine.add_timer(WEBSOCKET_TIMEOUT, ¬connected)
|
10
|
+
def self.usable?(client, endpoint, &callback)
|
11
|
+
create(client, endpoint).usable?(&callback)
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.create(client, endpoint)
|
15
|
+
sockets = client.transports[:websocket] ||= {}
|
16
|
+
sockets[endpoint] ||= new(client, endpoint)
|
33
17
|
end
|
34
18
|
|
35
19
|
def batching?
|
36
20
|
false
|
37
21
|
end
|
38
22
|
|
23
|
+
def usable?(&callback)
|
24
|
+
self.callback { callback.call(true) }
|
25
|
+
self.errback { callback.call(false) }
|
26
|
+
connect
|
27
|
+
end
|
28
|
+
|
39
29
|
def request(messages, timeout = nil)
|
40
30
|
return if messages.empty?
|
41
31
|
@messages ||= {}
|
42
32
|
messages.each { |message| @messages[message['id']] = message }
|
43
|
-
|
44
|
-
end
|
45
|
-
|
46
|
-
def with_socket(&resume)
|
47
|
-
callback(&resume)
|
33
|
+
callback { |socket| socket.send(Faye.to_json(messages)) }
|
48
34
|
connect
|
49
35
|
end
|
50
36
|
|
@@ -66,6 +52,7 @@ module Faye
|
|
66
52
|
|
67
53
|
@socket.onopen = lambda do |*args|
|
68
54
|
@state = CONNECTED
|
55
|
+
@ever_connected = true
|
69
56
|
set_deferred_status(:succeeded, @socket)
|
70
57
|
trigger(:up)
|
71
58
|
end
|
@@ -83,6 +70,7 @@ module Faye
|
|
83
70
|
@socket = nil
|
84
71
|
|
85
72
|
next resend if was_connected
|
73
|
+
next set_deferred_status(:failed) unless @ever_connected
|
86
74
|
|
87
75
|
EventMachine.add_timer(@client.retry) { connect }
|
88
76
|
trigger(:down)
|
@@ -90,6 +78,7 @@ module Faye
|
|
90
78
|
end
|
91
79
|
|
92
80
|
def resend
|
81
|
+
return unless @messages
|
93
82
|
request(@messages.values)
|
94
83
|
end
|
95
84
|
end
|
data/lib/faye-browser-min.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
var Faye=(typeof Faye==='object')?Faye:{};if(typeof window!=='undefined')window.Faye=Faye;Faye.extend=function(a,b,d){if(!b)return a;for(var f in b){if(!b.hasOwnProperty(f))continue;if(a.hasOwnProperty(f)&&d===false)continue;if(a[f]!==b[f])a[f]=b[f]}return a};Faye.extend(Faye,{VERSION:'0.8.3',BAYEUX_VERSION:'1.0',ID_LENGTH:128,JSONP_CALLBACK:'jsonpcallback',CONNECTION_TYPES:['long-polling','cross-origin-long-polling','callback-polling','websocket','eventsource','in-process'],MANDATORY_CONNECTION_TYPES:['long-polling','callback-polling','in-process'],ENV:(function(){return this})(),random:function(a){a=a||this.ID_LENGTH;if(a>32){var b=Math.ceil(a/32),d='';while(b--)d+=this.random(32);return d}var f=Math.pow(2,a)-1,g=f.toString(36).length,d=Math.floor(Math.random()*f).toString(36);while(d.length<g)d='0'+d;return d},clientIdFromMessages:function(a){var b=[].concat(a)[0];return b&&b.clientId},copyObject:function(a){var b,d,f;if(a instanceof Array){b=[];d=a.length;while(d--)b[d]=Faye.copyObject(a[d]);return b}else if(typeof a==='object'){b=(a===null)?null:{};for(f in a)b[f]=Faye.copyObject(a[f]);return b}else{return a}},commonElement:function(a,b){for(var d=0,f=a.length;d<f;d++){if(this.indexOf(b,a[d])!==-1)return a[d]}return null},indexOf:function(a,b){if(a.indexOf)return a.indexOf(b);for(var d=0,f=a.length;d<f;d++){if(a[d]===b)return d}return-1},map:function(a,b,d){if(a.map)return a.map(b,d);var f=[];if(a instanceof Array){for(var g=0,h=a.length;g<h;g++){f.push(b.call(d||null,a[g],g))}}else{for(var k in a){if(!a.hasOwnProperty(k))continue;f.push(b.call(d||null,k,a[k]))}}return f},filter:function(a,b,d){var f=[];for(var g=0,h=a.length;g<h;g++){if(b.call(d||null,a[g],g))f.push(a[g])}return f},asyncEach:function(a,b,d,f){var g=a.length,h=-1,k=0,j=false;var i=function(){k-=1;h+=1;if(h===g)return d&&d.call(f);b(a[h],n)};var l=function(){if(j)return;j=true;while(k>0)i();j=false};var n=function(){k+=1;l()};n()},toJSON:function(a){if(this.stringify)return this.stringify(a,function(key,value){return(this[key]instanceof Array)?this[key]:value});return JSON.stringify(a)},logger:function(a){if(typeof console!=='undefined')console.log(a)},timestamp:function(){var b=new Date(),d=b.getFullYear(),f=b.getMonth()+1,g=b.getDate(),h=b.getHours(),k=b.getMinutes(),j=b.getSeconds();var i=function(a){return a<10?'0'+a:String(a)};return i(d)+'-'+i(f)+'-'+i(g)+' '+i(h)+':'+i(k)+':'+i(j)}});Faye.Class=function(a,b){if(typeof a!=='function'){b=a;a=Object}var d=function(){if(!this.initialize)return this;return this.initialize.apply(this,arguments)||this};var f=function(){};f.prototype=a.prototype;d.prototype=new f();Faye.extend(d.prototype,b);return d};Faye.Namespace=Faye.Class({initialize:function(){this._d={}},exists:function(a){return this._d.hasOwnProperty(a)},generate:function(){var a=Faye.random();while(this._d.hasOwnProperty(a))a=Faye.random();return this._d[a]=a},release:function(a){delete this._d[a]}});Faye.Error=Faye.Class({initialize:function(a,b,d){this.code=a;this.params=Array.prototype.slice.call(b);this.message=d},toString:function(){return this.code+':'+this.params.join(',')+':'+this.message}});Faye.Error.parse=function(a){a=a||'';if(!Faye.Grammar.ERROR.test(a))return new this(null,[],a);var b=a.split(':'),d=parseInt(b[0]),f=b[1].split(','),a=b[2];return new this(d,f,a)};Faye.Error.versionMismatch=function(){return new this(300,arguments,"Version mismatch").toString()};Faye.Error.conntypeMismatch=function(){return new this(301,arguments,"Connection types not supported").toString()};Faye.Error.extMismatch=function(){return new this(302,arguments,"Extension mismatch").toString()};Faye.Error.badRequest=function(){return new this(400,arguments,"Bad request").toString()};Faye.Error.clientUnknown=function(){return new this(401,arguments,"Unknown client").toString()};Faye.Error.parameterMissing=function(){return new this(402,arguments,"Missing required parameter").toString()};Faye.Error.channelForbidden=function(){return new this(403,arguments,"Forbidden channel").toString()};Faye.Error.channelUnknown=function(){return new this(404,arguments,"Unknown channel").toString()};Faye.Error.channelInvalid=function(){return new this(405,arguments,"Invalid channel").toString()};Faye.Error.extUnknown=function(){return new this(406,arguments,"Unknown extension").toString()};Faye.Error.publishFailed=function(){return new this(407,arguments,"Failed to publish").toString()};Faye.Error.serverError=function(){return new this(500,arguments,"Internal server error").toString()};Faye.Deferrable={callback:function(a,b){if(!a)return;if(this._v==='succeeded')return a.apply(b,this._k);this._l=this._l||[];this._l.push([a,b])},timeout:function(a,b){var d=this;var f=Faye.ENV.setTimeout(function(){d.setDeferredStatus('failed',b)},a*1000);this._w=f},errback:function(a,b){if(!a)return;if(this._v==='failed')return a.apply(b,this._k);this._m=this._m||[];this._m.push([a,b])},setDeferredStatus:function(){if(this._w)Faye.ENV.clearTimeout(this._w);var a=Array.prototype.slice.call(arguments),b=a.shift(),d;this._v=b;this._k=a;if(b==='succeeded')d=this._l;else if(b==='failed')d=this._m;if(!d)return;var f;while(f=d.shift())f[0].apply(f[1],this._k)}};Faye.Publisher={countListeners:function(a){if(!this._3||!this._3[a])return 0;return this._3[a].length},bind:function(a,b,d){this._3=this._3||{};var f=this._3[a]=this._3[a]||[];f.push([b,d])},unbind:function(a,b,d){if(!this._3||!this._3[a])return;if(!b){delete this._3[a];return}var f=this._3[a],g=f.length;while(g--){if(b!==f[g][0])continue;if(d&&f[g][1]!==d)continue;f.splice(g,1)}},trigger:function(){var a=Array.prototype.slice.call(arguments),b=a.shift();if(!this._3||!this._3[b])return;var d=this._3[b].slice(),f;for(var g=0,h=d.length;g<h;g++){f=d[g];f[0].apply(f[1],a)}}};Faye.Timeouts={addTimeout:function(a,b,d,f){this._5=this._5||{};if(this._5.hasOwnProperty(a))return;var g=this;this._5[a]=Faye.ENV.setTimeout(function(){delete g._5[a];d.call(f)},1000*b)},removeTimeout:function(a){this._5=this._5||{};var b=this._5[a];if(!b)return;clearTimeout(b);delete this._5[a]}};Faye.Logging={LOG_LEVELS:{error:3,warn:2,info:1,debug:0},logLevel:'error',log:function(a,b){if(!Faye.logger)return;var d=Faye.Logging.LOG_LEVELS;if(d[Faye.Logging.logLevel]>d[b])return;var a=Array.prototype.slice.apply(a),f=' ['+b.toUpperCase()+'] [Faye',g=this.className,h=a.shift().replace(/\?/g,function(){try{return Faye.toJSON(a.shift())}catch(e){return'[Object]'}});for(var k in Faye){if(g)continue;if(typeof Faye[k]!=='function')continue;if(this instanceof Faye[k])g=k}if(g)f+='.'+g;f+='] ';Faye.logger(Faye.timestamp()+f+h)}};(function(){for(var d in Faye.Logging.LOG_LEVELS)(function(a,b){Faye.Logging[a]=function(){this.log(arguments,a)}})(d,Faye.Logging.LOG_LEVELS[d])})();Faye.Grammar={LOWALPHA:/^[a-z]$/,UPALPHA:/^[A-Z]$/,ALPHA:/^([a-z]|[A-Z])$/,DIGIT:/^[0-9]$/,ALPHANUM:/^(([a-z]|[A-Z])|[0-9])$/,MARK:/^(\-|\_|\!|\~|\(|\)|\$|\@)$/,STRING:/^(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*$/,TOKEN:/^(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)))+$/,INTEGER:/^([0-9])+$/,CHANNEL_SEGMENT:/^(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)))+$/,CHANNEL_SEGMENTS:/^(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)))+(\/(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)))+)*$/,CHANNEL_NAME:/^\/(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)))+(\/(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)))+)*$/,WILD_CARD:/^\*{1,2}$/,CHANNEL_PATTERN:/^(\/(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)))+)*\/\*{1,2}$/,VERSION_ELEMENT:/^(([a-z]|[A-Z])|[0-9])(((([a-z]|[A-Z])|[0-9])|\-|\_))*$/,VERSION:/^([0-9])+(\.(([a-z]|[A-Z])|[0-9])(((([a-z]|[A-Z])|[0-9])|\-|\_))*)*$/,CLIENT_ID:/^((([a-z]|[A-Z])|[0-9]))+$/,ID:/^((([a-z]|[A-Z])|[0-9]))+$/,ERROR_MESSAGE:/^(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*$/,ERROR_ARGS:/^(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*(,(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*)*$/,ERROR_CODE:/^[0-9][0-9][0-9]$/,ERROR:/^([0-9][0-9][0-9]:(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*(,(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*)*:(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*|[0-9][0-9][0-9]::(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*)$/};Faye.Extensible={addExtension:function(a){this._6=this._6||[];this._6.push(a);if(a.added)a.added(this)},removeExtension:function(a){if(!this._6)return;var b=this._6.length;while(b--){if(this._6[b]!==a)continue;this._6.splice(b,1);if(a.removed)a.removed(this)}},pipeThroughExtensions:function(d,f,g,h){this.debug('Passing through ? extensions: ?',d,f);if(!this._6)return g.call(h,f);var k=this._6.slice();var j=function(a){if(!a)return g.call(h,a);var b=k.shift();if(!b)return g.call(h,a);if(b[d])b[d](a,j);else j(a)};j(f)}};Faye.extend(Faye.Extensible,Faye.Logging);Faye.Channel=Faye.Class({initialize:function(a){this.id=this.name=a},push:function(a){this.trigger('message',a)},isUnused:function(){return this.countListeners('message')===0}});Faye.extend(Faye.Channel.prototype,Faye.Publisher);Faye.extend(Faye.Channel,{HANDSHAKE:'/meta/handshake',CONNECT:'/meta/connect',SUBSCRIBE:'/meta/subscribe',UNSUBSCRIBE:'/meta/unsubscribe',DISCONNECT:'/meta/disconnect',META:'meta',SERVICE:'service',expand:function(a){var b=this.parse(a),d=['/**',a];var f=b.slice();f[f.length-1]='*';d.push(this.unparse(f));for(var g=1,h=b.length;g<h;g++){f=b.slice(0,g);f.push('**');d.push(this.unparse(f))}return d},isValid:function(a){return Faye.Grammar.CHANNEL_NAME.test(a)||Faye.Grammar.CHANNEL_PATTERN.test(a)},parse:function(a){if(!this.isValid(a))return null;return a.split('/').slice(1)},unparse:function(a){return'/'+a.join('/')},isMeta:function(a){var b=this.parse(a);return b?(b[0]===this.META):null},isService:function(a){var b=this.parse(a);return b?(b[0]===this.SERVICE):null},isSubscribable:function(a){if(!this.isValid(a))return null;return!this.isMeta(a)&&!this.isService(a)},Set:Faye.Class({initialize:function(){this._2={}},getKeys:function(){var a=[];for(var b in this._2)a.push(b);return a},remove:function(a){delete this._2[a]},hasSubscription:function(a){return this._2.hasOwnProperty(a)},subscribe:function(a,b,d){if(!b)return;var f;for(var g=0,h=a.length;g<h;g++){f=a[g];var k=this._2[f]=this._2[f]||new Faye.Channel(f);k.bind('message',b,d)}},unsubscribe:function(a,b,d){var f=this._2[a];if(!f)return false;f.unbind('message',b,d);if(f.isUnused()){this.remove(a);return true}else{return false}},distributeMessage:function(a){var b=Faye.Channel.expand(a.channel);for(var d=0,f=b.length;d<f;d++){var g=this._2[b[d]];if(g)g.trigger('message',a.data)}}})});Faye.Publication=Faye.Class(Faye.Deferrable);Faye.Subscription=Faye.Class({initialize:function(a,b,d,f){this._7=a;this._2=b;this._n=d;this._o=f;this._x=false},cancel:function(){if(this._x)return;this._7.unsubscribe(this._2,this._n,this._o);this._x=true},unsubscribe:function(){this.cancel()}});Faye.extend(Faye.Subscription.prototype,Faye.Deferrable);Faye.Client=Faye.Class({UNCONNECTED:1,CONNECTING:2,CONNECTED:3,DISCONNECTED:4,HANDSHAKE:'handshake',RETRY:'retry',NONE:'none',CONNECTION_TIMEOUT:60.0,DEFAULT_RETRY:5.0,DEFAULT_ENDPOINT:'/bayeux',INTERVAL:0.0,initialize:function(a,b){this.info('New client created for ?',a);this._e=b||{};this.endpoint=a||this.DEFAULT_ENDPOINT;this.endpoints=this._e.endpoints||{};this._E=Faye.CookieJar&&new Faye.CookieJar();this._y={};this._p=[];this.retry=this._e.retry||this.DEFAULT_RETRY;this._z(Faye.MANDATORY_CONNECTION_TYPES);this._1=this.UNCONNECTED;this._2=new Faye.Channel.Set();this._f=0;this._q={};this._8={reconnect:this.RETRY,interval:1000*(this._e.interval||this.INTERVAL),timeout:1000*(this._e.timeout||this.CONNECTION_TIMEOUT)};if(Faye.Event)Faye.Event.on(Faye.ENV,'beforeunload',function(){if(Faye.indexOf(this._p,'autodisconnect')<0)this.disconnect()},this)},disable:function(a){this._p.push(a)},setHeader:function(a,b){this._y[a]=b},getClientId:function(){return this._0},getState:function(){switch(this._1){case this.UNCONNECTED:return'UNCONNECTED';case this.CONNECTING:return'CONNECTING';case this.CONNECTED:return'CONNECTED';case this.DISCONNECTED:return'DISCONNECTED'}},handshake:function(f,g){if(this._8.reconnect===this.NONE)return;if(this._1!==this.UNCONNECTED)return;this._1=this.CONNECTING;var h=this;this.info('Initiating handshake with ?',this.endpoint);this._9({channel:Faye.Channel.HANDSHAKE,version:Faye.BAYEUX_VERSION,supportedConnectionTypes:[this._a.connectionType]},function(b){if(b.successful){this._1=this.CONNECTED;this._0=b.clientId;var d=Faye.filter(b.supportedConnectionTypes,function(a){return Faye.indexOf(this._p,a)<0},this);this._z(d);this.info('Handshake successful: ?',this._0);this.subscribe(this._2.getKeys(),true);if(f)f.call(g)}else{this.info('Handshake unsuccessful');Faye.ENV.setTimeout(function(){h.handshake(f,g)},this._8.interval);this._1=this.UNCONNECTED}},this)},connect:function(a,b){if(this._8.reconnect===this.NONE)return;if(this._1===this.DISCONNECTED)return;if(this._1===this.UNCONNECTED)return this.handshake(function(){this.connect(a,b)},this);this.callback(a,b);if(this._1!==this.CONNECTED)return;this.info('Calling deferred actions for ?',this._0);this.setDeferredStatus('succeeded');this.setDeferredStatus('deferred');if(this._r)return;this._r=true;this.info('Initiating connection for ?',this._0);this._9({channel:Faye.Channel.CONNECT,clientId:this._0,connectionType:this._a.connectionType},this._A,this)},disconnect:function(){if(this._1!==this.CONNECTED)return;this._1=this.DISCONNECTED;this.info('Disconnecting ?',this._0);this._9({channel:Faye.Channel.DISCONNECT,clientId:this._0},function(a){if(a.successful)this._a.close()},this);this.info('Clearing channel listeners for ?',this._0);this._2=new Faye.Channel.Set()},subscribe:function(d,f,g){if(d instanceof Array)return Faye.map(d,function(c){return this.subscribe(c,f,g)},this);var h=new Faye.Subscription(this,d,f,g),k=(f===true),j=this._2.hasSubscription(d);if(j&&!k){this._2.subscribe([d],f,g);h.setDeferredStatus('succeeded');return h}this.connect(function(){this.info('Client ? attempting to subscribe to ?',this._0,d);if(!k)this._2.subscribe([d],f,g);this._9({channel:Faye.Channel.SUBSCRIBE,clientId:this._0,subscription:d},function(a){if(!a.successful){h.setDeferredStatus('failed',Faye.Error.parse(a.error));return this._2.unsubscribe(d,f,g)}var b=[].concat(a.subscription);this.info('Subscription acknowledged for ? to ?',this._0,b);h.setDeferredStatus('succeeded')},this)},this);return h},unsubscribe:function(d,f,g){if(d instanceof Array)return Faye.map(d,function(c){return this.unsubscribe(c,f,g)},this);var h=this._2.unsubscribe(d,f,g);if(!h)return;this.connect(function(){this.info('Client ? attempting to unsubscribe from ?',this._0,d);this._9({channel:Faye.Channel.UNSUBSCRIBE,clientId:this._0,subscription:d},function(a){if(!a.successful)return;var b=[].concat(a.subscription);this.info('Unsubscription acknowledged for ? from ?',this._0,b)},this)},this)},publish:function(b,d){var f=new Faye.Publication();this.connect(function(){this.info('Client ? queueing published message to ?: ?',this._0,b,d);this._9({channel:b,data:d,clientId:this._0},function(a){if(a.successful)f.setDeferredStatus('succeeded');else f.setDeferredStatus('failed',Faye.Error.parse(a.error))},this)},this);return f},receiveMessage:function(d){this.pipeThroughExtensions('incoming',d,function(a){if(!a)return;if(a.advice)this._F(a.advice);this._G(a);if(a.successful===undefined)return;var b=this._q[a.id];if(!b)return;delete this._q[a.id];b[0].call(b[1],a)},this)},_z:function(b){Faye.Transport.get(this,b,function(a){this._a=a;this._a.cookies=this._E;this._a.headers=this._y;a.bind('down',function(){if(this._c!==undefined&&!this._c)return;this._c=false;this.trigger('transport:down')},this);a.bind('up',function(){if(this._c!==undefined&&this._c)return;this._c=true;this.trigger('transport:up')},this)},this)},_9:function(b,d,f){b.id=this._H();if(d)this._q[b.id]=[d,f];this.pipeThroughExtensions('outgoing',b,function(a){if(!a)return;this._a.send(a,this._8.timeout/1000)},this)},_H:function(){this._f+=1;if(this._f>=Math.pow(2,32))this._f=0;return this._f.toString(36)},_F:function(a){Faye.extend(this._8,a);if(this._8.reconnect===this.HANDSHAKE&&this._1!==this.DISCONNECTED){this._1=this.UNCONNECTED;this._0=null;this._A()}},_G:function(a){if(!a.channel||a.data===undefined)return;this.info('Client ? calling listeners for ? with ?',this._0,a.channel,a.data);this._2.distributeMessage(a)},_I:function(){if(!this._r)return;this._r=null;this.info('Closed connection for ?',this._0)},_A:function(){this._I();var a=this;Faye.ENV.setTimeout(function(){a.connect()},this._8.interval)}});Faye.extend(Faye.Client.prototype,Faye.Deferrable);Faye.extend(Faye.Client.prototype,Faye.Publisher);Faye.extend(Faye.Client.prototype,Faye.Logging);Faye.extend(Faye.Client.prototype,Faye.Extensible);Faye.Transport=Faye.extend(Faye.Class({MAX_DELAY:0.0,batching:true,initialize:function(a,b){this.debug('Created new ? transport for ?',this.connectionType,b);this._7=a;this._b=b;this._g=[]},close:function(){},send:function(a,b){this.debug('Client ? sending message to ?: ?',this._7._0,this._b,a);if(!this.batching)return this.request([a],b);this._g.push(a);this._J=b;if(a.channel===Faye.Channel.HANDSHAKE)return this.flush();if(a.channel===Faye.Channel.CONNECT)this._s=a;this.addTimeout('publish',this.MAX_DELAY,this.flush,this)},flush:function(){this.removeTimeout('publish');if(this._g.length>1&&this._s)this._s.advice={timeout:0};this.request(this._g,this._J);this._s=null;this._g=[]},receive:function(a){this.debug('Client ? received from ?: ?',this._7._0,this._b,a);for(var b=0,d=a.length;b<d;b++){this._7.receiveMessage(a[b])}},retry:function(a,b){var d=false,f=this._7.retry*1000,g=this;return function(){if(d)return;d=true;Faye.ENV.setTimeout(function(){g.request(a,b)},f)}}}),{get:function(k,j,i,l){var n=k.endpoint;if(j===undefined)j=this.supportedConnectionTypes();Faye.asyncEach(this._t,function(b,d){var f=b[0],g=b[1],h=k.endpoints[f]||n;if(Faye.indexOf(j,f)<0)return d();g.isUsable(h,function(a){if(a)i.call(l,new g(k,h));else d()})},function(){throw new Error('Could not find a usable connection type for '+n);})},register:function(a,b){this._t.push([a,b]);b.prototype.connectionType=a},_t:[],supportedConnectionTypes:function(){return Faye.map(this._t,function(a){return a[0]})}});Faye.extend(Faye.Transport.prototype,Faye.Logging);Faye.extend(Faye.Transport.prototype,Faye.Publisher);Faye.extend(Faye.Transport.prototype,Faye.Timeouts);Faye.Event={_h:[],on:function(a,b,d,f){var g=function(){d.call(f)};if(a.addEventListener)a.addEventListener(b,g,false);else a.attachEvent('on'+b,g);this._h.push({_i:a,_u:b,_n:d,_o:f,_B:g})},detach:function(a,b,d,f){var g=this._h.length,h;while(g--){h=this._h[g];if((a&&a!==h._i)||(b&&b!==h._u)||(d&&d!==h._n)||(f&&f!==h._o))continue;if(h._i.removeEventListener)h._i.removeEventListener(h._u,h._B,false);else h._i.detachEvent('on'+h._u,h._B);this._h.splice(g,1);h=null}}};Faye.Event.on(Faye.ENV,'unload',Faye.Event.detach,Faye.Event);Faye.URI=Faye.extend(Faye.Class({queryString:function(){var a=[];for(var b in this.params){if(!this.params.hasOwnProperty(b))continue;a.push(encodeURIComponent(b)+'='+encodeURIComponent(this.params[b]))}return a.join('&')},isLocal:function(){var a=Faye.URI.parse(Faye.ENV.location.href);var b=(a.hostname!==this.hostname)||(a.port!==this.port)||(a.protocol!==this.protocol);return!b},toURL:function(){var a=this.queryString();return this.protocol+this.hostname+(this.port?':'+this.port:'')+this.pathname+(a?'?'+a:'')}}),{parse:function(a,b){if(typeof a!=='string')return a;var d=document.createElement('a'),f=new this();d.href=a;f.protocol=d.protocol+'//';f.hostname=d.hostname;f.pathname=d.pathname.replace(/^\/?/,'/');if(d.port==='0'||d.port==='')f.port=(d.protocol==='https:')?'443':'80';else f.port=d.port;var g=d.search.replace(/^\?/,''),h=g?g.split('&'):[],k=h.length,j={},i;while(k--){i=h[k].split('=');j[decodeURIComponent(i[0]||'')]=decodeURIComponent(i[1]||'')}if(typeof b==='object')Faye.extend(j,b);f.params=j;return f}});if(!this.JSON){JSON={}}(function(){function l(a){return a<10?'0'+a:a}if(typeof Date.prototype.toJSON!=='function'){Date.prototype.toJSON=function(a){return this.getUTCFullYear()+'-'+l(this.getUTCMonth()+1)+'-'+l(this.getUTCDate())+'T'+l(this.getUTCHours())+':'+l(this.getUTCMinutes())+':'+l(this.getUTCSeconds())+'Z'};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(a){return this.valueOf()}}var n=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,o=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,m,q,t={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},p;function s(d){o.lastIndex=0;return o.test(d)?'"'+d.replace(o,function(a){var b=t[a];return typeof b==='string'?b:'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+d+'"'}function r(a,b){var d,f,g,h,k=m,j,i=b[a];if(i&&typeof i==='object'&&typeof i.toJSON==='function'){i=i.toJSON(a)}if(typeof p==='function'){i=p.call(b,a,i)}switch(typeof i){case'string':return s(i);case'number':return isFinite(i)?String(i):'null';case'boolean':case'null':return String(i);case'object':if(!i){return'null'}m+=q;j=[];if(Object.prototype.toString.apply(i)==='[object Array]'){h=i.length;for(d=0;d<h;d+=1){j[d]=r(d,i)||'null'}g=j.length===0?'[]':m?'[\n'+m+j.join(',\n'+m)+'\n'+k+']':'['+j.join(',')+']';m=k;return g}if(p&&typeof p==='object'){h=p.length;for(d=0;d<h;d+=1){f=p[d];if(typeof f==='string'){g=r(f,i);if(g){j.push(s(f)+(m?': ':':')+g)}}}}else{for(f in i){if(Object.hasOwnProperty.call(i,f)){g=r(f,i);if(g){j.push(s(f)+(m?': ':':')+g)}}}}g=j.length===0?'{}':m?'{\n'+m+j.join(',\n'+m)+'\n'+k+'}':'{'+j.join(',')+'}';m=k;return g}}Faye.stringify=function(a,b,d){var f;m='';q='';if(typeof d==='number'){for(f=0;f<d;f+=1){q+=' '}}else if(typeof d==='string'){q=d}p=b;if(b&&typeof b!=='function'&&(typeof b!=='object'||typeof b.length!=='number')){throw new Error('JSON.stringify');}return r('',{'':a})};if(typeof JSON.stringify!=='function'){JSON.stringify=Faye.stringify}if(typeof JSON.parse!=='function'){JSON.parse=function(h,k){var j;function i(a,b){var d,f,g=a[b];if(g&&typeof g==='object'){for(d in g){if(Object.hasOwnProperty.call(g,d)){f=i(g,d);if(f!==undefined){g[d]=f}else{delete g[d]}}}}return k.call(a,b,g)}n.lastIndex=0;if(n.test(h)){h=h.replace(n,function(a){return'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4)})}if(/^[\],:{}\s]*$/.test(h.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,'@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']').replace(/(?:^|:|,)(?:\s*\[)+/g,''))){j=eval('('+h+')');return typeof k==='function'?i({'':j},''):j}throw new SyntaxError('JSON.parse');}}}());Faye.Transport.WebSocket=Faye.extend(Faye.Class(Faye.Transport,{UNCONNECTED:1,CONNECTING:2,CONNECTED:3,batching:false,request:function(b,d){if(b.length===0)return;this._j=this._j||{};for(var f=0,g=b.length;f<g;f++){this._j[b[f].id]=b[f]}this.withSocket(function(a){a.send(Faye.toJSON(b))})},withSocket:function(a,b){this.callback(a,b);this.connect()},close:function(){if(this._C)return;this._C=true;if(this._4)this._4.close()},connect:function(){if(Faye.Transport.WebSocket._K)return;if(this._C)return;this._1=this._1||this.UNCONNECTED;if(this._1!==this.UNCONNECTED)return;this._1=this.CONNECTING;var g=Faye.Transport.WebSocket.getClass();this._4=new g(Faye.Transport.WebSocket.getSocketUrl(this._b));var h=this;this._4.onopen=function(){h._1=h.CONNECTED;h.setDeferredStatus('succeeded',h._4);h.trigger('up')};this._4.onmessage=function(a){var b=[].concat(JSON.parse(a.data));for(var d=0,f=b.length;d<f;d++){delete h._j[b[d].id]}h.receive(b)};this._4.onclose=function(){var a=(h._1===h.CONNECTED);h.setDeferredStatus('deferred');h._1=h.UNCONNECTED;delete h._4;if(a)return h.resend();var b=h._7.retry*1000;Faye.ENV.setTimeout(function(){h.connect()},b);h.trigger('down')}},resend:function(){var d=Faye.map(this._j,function(a,b){return b});this.request(d)}}),{WEBSOCKET_TIMEOUT:1000,getSocketUrl:function(a){if(Faye.URI)a=Faye.URI.parse(a).toURL();return a.replace(/^http(s?):/ig,'ws$1:')},getClass:function(){return(Faye.WebSocket&&Faye.WebSocket.Client)||Faye.ENV.WebSocket||Faye.ENV.MozWebSocket},isUsable:function(a,b,d){var f=this.getClass();if(!f)return b.call(d,false);var g=false,h=false,k=this.getSocketUrl(a),j=new f(k);j.onopen=function(){g=true;j.close();b.call(d,true);h=true;j=null};var i=function(){if(!h&&!g)b.call(d,false);h=true};j.onclose=j.onerror=i;Faye.ENV.setTimeout(i,this.WEBSOCKET_TIMEOUT)}});Faye.extend(Faye.Transport.WebSocket.prototype,Faye.Deferrable);Faye.Transport.register('websocket',Faye.Transport.WebSocket);if(Faye.Event)Faye.Event.on(Faye.ENV,'beforeunload',function(){Faye.Transport.WebSocket._K=true});Faye.Transport.EventSource=Faye.extend(Faye.Class(Faye.Transport,{initialize:function(b,d){Faye.Transport.prototype.initialize.call(this,b,d);this._L=new Faye.Transport.XHR(b,d);var f=new EventSource(d+'/'+b.getClientId()),g=this;f.onopen=function(){g.trigger('up')};f.onerror=function(){g.trigger('down')};f.onmessage=function(a){g.receive(JSON.parse(a.data))};this._4=f},request:function(a,b){this._L.request(a,b)},close:function(){this._4.close()}}),{isUsable:function(b,d,f){Faye.Transport.XHR.isUsable(b,function(a){d.call(f,a&&Faye.ENV.EventSource)})}});Faye.Transport.register('eventsource',Faye.Transport.EventSource);Faye.Transport.XHR=Faye.extend(Faye.Class(Faye.Transport,{request:function(f,g){var h=this.retry(f,g),k=Faye.URI.parse(this._b).pathname,j=this,i=Faye.ENV.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();i.open('POST',k,true);i.setRequestHeader('Content-Type','application/json');i.setRequestHeader('X-Requested-With','XMLHttpRequest');var l=this.headers;for(var n in l){if(!l.hasOwnProperty(n))continue;i.setRequestHeader(n,l[n])}var o=function(){i.abort()};Faye.Event.on(Faye.ENV,'beforeunload',o);var m=function(){Faye.Event.detach(Faye.ENV,'beforeunload',o);i.onreadystatechange=function(){};i=null};i.onreadystatechange=function(){if(i.readyState!==4)return;var a=null,b=i.status,d=((b>=200&&b<300)||b===304||b===1223);if(!d){m();h();return j.trigger('down')}try{a=JSON.parse(i.responseText)}catch(e){}m();if(a){j.receive(a);j.trigger('up')}else{h();j.trigger('down')}};i.send(Faye.toJSON(f))}}),{isUsable:function(a,b,d){b.call(d,Faye.URI.parse(a).isLocal())}});Faye.Transport.register('long-polling',Faye.Transport.XHR);Faye.Transport.CORS=Faye.extend(Faye.Class(Faye.Transport,{request:function(b,d){var f=Faye.ENV.XDomainRequest?XDomainRequest:XMLHttpRequest,g=new f(),h=this.retry(b,d),k=this;g.open('POST',this._b,true);var j=function(){if(!g)return false;g.onload=g.onerror=g.ontimeout=g.onprogress=null;g=null;Faye.ENV.clearTimeout(l);return true};g.onload=function(){var a=null;try{a=JSON.parse(g.responseText)}catch(e){}j();if(a){k.receive(a);k.trigger('up')}else{h();k.trigger('down')}};var i=function(){j();h();k.trigger('down')};var l=Faye.ENV.setTimeout(i,1.5*1000*d);g.onerror=i;g.ontimeout=i;g.onprogress=function(){};g.send('message='+encodeURIComponent(Faye.toJSON(b)))}}),{isUsable:function(a,b,d){if(Faye.URI.parse(a).isLocal())return b.call(d,false);if(Faye.ENV.XDomainRequest)return b.call(d,Faye.URI.parse(a).protocol===Faye.URI.parse(Faye.ENV.location).protocol);if(Faye.ENV.XMLHttpRequest){var f=new Faye.ENV.XMLHttpRequest();return b.call(d,f.withCredentials!==undefined)}return b.call(d,false)}});Faye.Transport.register('cross-origin-long-polling',Faye.Transport.CORS);Faye.Transport.JSONP=Faye.extend(Faye.Class(Faye.Transport,{request:function(b,d){var f={message:Faye.toJSON(b)},g=document.getElementsByTagName('head')[0],h=document.createElement('script'),k=Faye.Transport.JSONP.getCallbackName(),j=Faye.URI.parse(this._b,f),i=this.retry(b,d),l=this;Faye.ENV[k]=function(a){o();l.receive(a);l.trigger('up')};var n=Faye.ENV.setTimeout(function(){o();i();l.trigger('down')},1.5*1000*d);var o=function(){if(!Faye.ENV[k])return false;Faye.ENV[k]=undefined;try{delete Faye.ENV[k]}catch(e){}Faye.ENV.clearTimeout(n);h.parentNode.removeChild(h);return true};j.params.jsonp=k;h.type='text/javascript';h.src=j.toURL();g.appendChild(h)}}),{_D:0,getCallbackName:function(){this._D+=1;return'__jsonp'+this._D+'__'},isUsable:function(a,b,d){b.call(d,true)}});Faye.Transport.register('callback-polling',Faye.Transport.JSONP);
|
1
|
+
var Faye=(typeof Faye==='object')?Faye:{};if(typeof window!=='undefined')window.Faye=Faye;Faye.extend=function(a,b,d){if(!b)return a;for(var f in b){if(!b.hasOwnProperty(f))continue;if(a.hasOwnProperty(f)&&d===false)continue;if(a[f]!==b[f])a[f]=b[f]}return a};Faye.extend(Faye,{VERSION:'0.8.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:(function(){return this})(),random:function(a){a=a||this.ID_LENGTH;if(a>32){var b=Math.ceil(a/32),d='';while(b--)d+=this.random(32);var f=d.split(''),g='';while(f.length>0)g+=f.pop();return g}var h=Math.pow(2,a)-1,j=h.toString(36).length,d=Math.floor(Math.random()*h).toString(36);while(d.length<j)d='0'+d;return d},clientIdFromMessages:function(a){var b=[].concat(a)[0];return b&&b.clientId},copyObject:function(a){var b,d,f;if(a instanceof Array){b=[];d=a.length;while(d--)b[d]=Faye.copyObject(a[d]);return b}else if(typeof a==='object'){b=(a===null)?null:{};for(f in a)b[f]=Faye.copyObject(a[f]);return b}else{return a}},commonElement:function(a,b){for(var d=0,f=a.length;d<f;d++){if(this.indexOf(b,a[d])!==-1)return a[d]}return null},indexOf:function(a,b){if(a.indexOf)return a.indexOf(b);for(var d=0,f=a.length;d<f;d++){if(a[d]===b)return d}return-1},map:function(a,b,d){if(a.map)return a.map(b,d);var f=[];if(a instanceof Array){for(var g=0,h=a.length;g<h;g++){f.push(b.call(d||null,a[g],g))}}else{for(var j in a){if(!a.hasOwnProperty(j))continue;f.push(b.call(d||null,j,a[j]))}}return f},filter:function(a,b,d){var f=[];for(var g=0,h=a.length;g<h;g++){if(b.call(d||null,a[g],g))f.push(a[g])}return f},asyncEach:function(a,b,d,f){var g=a.length,h=-1,j=0,k=false;var i=function(){j-=1;h+=1;if(h===g)return d&&d.call(f);b(a[h],m)};var l=function(){if(k)return;k=true;while(j>0)i();k=false};var m=function(){j+=1;l()};m()},toJSON:function(a){if(this.stringify)return this.stringify(a,function(key,value){return(this[key]instanceof Array)?this[key]:value});return JSON.stringify(a)},logger:function(a){if(typeof console!=='undefined')console.log(a)},timestamp:function(){var b=new Date(),d=b.getFullYear(),f=b.getMonth()+1,g=b.getDate(),h=b.getHours(),j=b.getMinutes(),k=b.getSeconds();var i=function(a){return a<10?'0'+a:String(a)};return i(d)+'-'+i(f)+'-'+i(g)+' '+i(h)+':'+i(j)+':'+i(k)}});Faye.Class=function(a,b){if(typeof a!=='function'){b=a;a=Object}var d=function(){if(!this.initialize)return this;return this.initialize.apply(this,arguments)||this};var f=function(){};f.prototype=a.prototype;d.prototype=new f();Faye.extend(d.prototype,b);return d};Faye.Namespace=Faye.Class({initialize:function(){this._e={}},exists:function(a){return this._e.hasOwnProperty(a)},generate:function(){var a=Faye.random();while(this._e.hasOwnProperty(a))a=Faye.random();return this._e[a]=a},release:function(a){delete this._e[a]}});Faye.Error=Faye.Class({initialize:function(a,b,d){this.code=a;this.params=Array.prototype.slice.call(b);this.message=d},toString:function(){return this.code+':'+this.params.join(',')+':'+this.message}});Faye.Error.parse=function(a){a=a||'';if(!Faye.Grammar.ERROR.test(a))return new this(null,[],a);var b=a.split(':'),d=parseInt(b[0]),f=b[1].split(','),a=b[2];return new this(d,f,a)};Faye.Error.versionMismatch=function(){return new this(300,arguments,"Version mismatch").toString()};Faye.Error.conntypeMismatch=function(){return new this(301,arguments,"Connection types not supported").toString()};Faye.Error.extMismatch=function(){return new this(302,arguments,"Extension mismatch").toString()};Faye.Error.badRequest=function(){return new this(400,arguments,"Bad request").toString()};Faye.Error.clientUnknown=function(){return new this(401,arguments,"Unknown client").toString()};Faye.Error.parameterMissing=function(){return new this(402,arguments,"Missing required parameter").toString()};Faye.Error.channelForbidden=function(){return new this(403,arguments,"Forbidden channel").toString()};Faye.Error.channelUnknown=function(){return new this(404,arguments,"Unknown channel").toString()};Faye.Error.channelInvalid=function(){return new this(405,arguments,"Invalid channel").toString()};Faye.Error.extUnknown=function(){return new this(406,arguments,"Unknown extension").toString()};Faye.Error.publishFailed=function(){return new this(407,arguments,"Failed to publish").toString()};Faye.Error.serverError=function(){return new this(500,arguments,"Internal server error").toString()};Faye.Deferrable={callback:function(a,b){if(!a)return;if(this._w==='succeeded')return a.apply(b,this._j);this._k=this._k||[];this._k.push([a,b])},timeout:function(a,b){var d=this;var f=Faye.ENV.setTimeout(function(){d.setDeferredStatus('failed',b)},a*1000);this._x=f},errback:function(a,b){if(!a)return;if(this._w==='failed')return a.apply(b,this._j);this._l=this._l||[];this._l.push([a,b])},setDeferredStatus:function(){if(this._x)Faye.ENV.clearTimeout(this._x);var a=Array.prototype.slice.call(arguments),b=a.shift(),d;this._w=b;this._j=a;if(b==='succeeded')d=this._k;else if(b==='failed')d=this._l;if(!d)return;var f;while(f=d.shift())f[0].apply(f[1],this._j)}};Faye.Publisher={countListeners:function(a){if(!this._3||!this._3[a])return 0;return this._3[a].length},bind:function(a,b,d){this._3=this._3||{};var f=this._3[a]=this._3[a]||[];f.push([b,d])},unbind:function(a,b,d){if(!this._3||!this._3[a])return;if(!b){delete this._3[a];return}var f=this._3[a],g=f.length;while(g--){if(b!==f[g][0])continue;if(d&&f[g][1]!==d)continue;f.splice(g,1)}},trigger:function(){var a=Array.prototype.slice.call(arguments),b=a.shift();if(!this._3||!this._3[b])return;var d=this._3[b].slice(),f;for(var g=0,h=d.length;g<h;g++){f=d[g];f[0].apply(f[1],a)}}};Faye.Timeouts={addTimeout:function(a,b,d,f){this._5=this._5||{};if(this._5.hasOwnProperty(a))return;var g=this;this._5[a]=Faye.ENV.setTimeout(function(){delete g._5[a];d.call(f)},1000*b)},removeTimeout:function(a){this._5=this._5||{};var b=this._5[a];if(!b)return;clearTimeout(b);delete this._5[a]}};Faye.Logging={LOG_LEVELS:{error:3,warn:2,info:1,debug:0},logLevel:'error',log:function(a,b){if(!Faye.logger)return;var d=Faye.Logging.LOG_LEVELS;if(d[Faye.Logging.logLevel]>d[b])return;var a=Array.prototype.slice.apply(a),f=' ['+b.toUpperCase()+'] [Faye',g=this.className,h=a.shift().replace(/\?/g,function(){try{return Faye.toJSON(a.shift())}catch(e){return'[Object]'}});for(var j in Faye){if(g)continue;if(typeof Faye[j]!=='function')continue;if(this instanceof Faye[j])g=j}if(g)f+='.'+g;f+='] ';Faye.logger(Faye.timestamp()+f+h)}};(function(){for(var d in Faye.Logging.LOG_LEVELS)(function(a,b){Faye.Logging[a]=function(){this.log(arguments,a)}})(d,Faye.Logging.LOG_LEVELS[d])})();Faye.Grammar={LOWALPHA:/^[a-z]$/,UPALPHA:/^[A-Z]$/,ALPHA:/^([a-z]|[A-Z])$/,DIGIT:/^[0-9]$/,ALPHANUM:/^(([a-z]|[A-Z])|[0-9])$/,MARK:/^(\-|\_|\!|\~|\(|\)|\$|\@)$/,STRING:/^(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*$/,TOKEN:/^(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)))+$/,INTEGER:/^([0-9])+$/,CHANNEL_SEGMENT:/^(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)))+$/,CHANNEL_SEGMENTS:/^(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)))+(\/(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)))+)*$/,CHANNEL_NAME:/^\/(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)))+(\/(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)))+)*$/,WILD_CARD:/^\*{1,2}$/,CHANNEL_PATTERN:/^(\/(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)))+)*\/\*{1,2}$/,VERSION_ELEMENT:/^(([a-z]|[A-Z])|[0-9])(((([a-z]|[A-Z])|[0-9])|\-|\_))*$/,VERSION:/^([0-9])+(\.(([a-z]|[A-Z])|[0-9])(((([a-z]|[A-Z])|[0-9])|\-|\_))*)*$/,CLIENT_ID:/^((([a-z]|[A-Z])|[0-9]))+$/,ID:/^((([a-z]|[A-Z])|[0-9]))+$/,ERROR_MESSAGE:/^(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*$/,ERROR_ARGS:/^(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*(,(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*)*$/,ERROR_CODE:/^[0-9][0-9][0-9]$/,ERROR:/^([0-9][0-9][0-9]:(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*(,(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*)*:(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*|[0-9][0-9][0-9]::(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*)$/};Faye.Extensible={addExtension:function(a){this._6=this._6||[];this._6.push(a);if(a.added)a.added(this)},removeExtension:function(a){if(!this._6)return;var b=this._6.length;while(b--){if(this._6[b]!==a)continue;this._6.splice(b,1);if(a.removed)a.removed(this)}},pipeThroughExtensions:function(d,f,g,h){this.debug('Passing through ? extensions: ?',d,f);if(!this._6)return g.call(h,f);var j=this._6.slice();var k=function(a){if(!a)return g.call(h,a);var b=j.shift();if(!b)return g.call(h,a);if(b[d])b[d](a,k);else k(a)};k(f)}};Faye.extend(Faye.Extensible,Faye.Logging);Faye.Channel=Faye.Class({initialize:function(a){this.id=this.name=a},push:function(a){this.trigger('message',a)},isUnused:function(){return this.countListeners('message')===0}});Faye.extend(Faye.Channel.prototype,Faye.Publisher);Faye.extend(Faye.Channel,{HANDSHAKE:'/meta/handshake',CONNECT:'/meta/connect',SUBSCRIBE:'/meta/subscribe',UNSUBSCRIBE:'/meta/unsubscribe',DISCONNECT:'/meta/disconnect',META:'meta',SERVICE:'service',expand:function(a){var b=this.parse(a),d=['/**',a];var f=b.slice();f[f.length-1]='*';d.push(this.unparse(f));for(var g=1,h=b.length;g<h;g++){f=b.slice(0,g);f.push('**');d.push(this.unparse(f))}return d},isValid:function(a){return Faye.Grammar.CHANNEL_NAME.test(a)||Faye.Grammar.CHANNEL_PATTERN.test(a)},parse:function(a){if(!this.isValid(a))return null;return a.split('/').slice(1)},unparse:function(a){return'/'+a.join('/')},isMeta:function(a){var b=this.parse(a);return b?(b[0]===this.META):null},isService:function(a){var b=this.parse(a);return b?(b[0]===this.SERVICE):null},isSubscribable:function(a){if(!this.isValid(a))return null;return!this.isMeta(a)&&!this.isService(a)},Set:Faye.Class({initialize:function(){this._2={}},getKeys:function(){var a=[];for(var b in this._2)a.push(b);return a},remove:function(a){delete this._2[a]},hasSubscription:function(a){return this._2.hasOwnProperty(a)},subscribe:function(a,b,d){if(!b)return;var f;for(var g=0,h=a.length;g<h;g++){f=a[g];var j=this._2[f]=this._2[f]||new Faye.Channel(f);j.bind('message',b,d)}},unsubscribe:function(a,b,d){var f=this._2[a];if(!f)return false;f.unbind('message',b,d);if(f.isUnused()){this.remove(a);return true}else{return false}},distributeMessage:function(a){var b=Faye.Channel.expand(a.channel);for(var d=0,f=b.length;d<f;d++){var g=this._2[b[d]];if(g)g.trigger('message',a.data)}}})});Faye.Publication=Faye.Class(Faye.Deferrable);Faye.Subscription=Faye.Class({initialize:function(a,b,d,f){this._7=a;this._2=b;this._m=d;this._n=f;this._y=false},cancel:function(){if(this._y)return;this._7.unsubscribe(this._2,this._m,this._n);this._y=true},unsubscribe:function(){this.cancel()}});Faye.extend(Faye.Subscription.prototype,Faye.Deferrable);Faye.Client=Faye.Class({UNCONNECTED:1,CONNECTING:2,CONNECTED:3,DISCONNECTED:4,HANDSHAKE:'handshake',RETRY:'retry',NONE:'none',CONNECTION_TIMEOUT:60.0,DEFAULT_RETRY:5.0,DEFAULT_ENDPOINT:'/bayeux',INTERVAL:0.0,initialize:function(a,b){this.info('New client created for ?',a);this._f=b||{};this.endpoint=a||this.DEFAULT_ENDPOINT;this.endpoints=this._f.endpoints||{};this.transports={};this._E=Faye.CookieJar&&new Faye.CookieJar();this._z={};this._o=[];this.retry=this._f.retry||this.DEFAULT_RETRY;this._A(Faye.MANDATORY_CONNECTION_TYPES);this._1=this.UNCONNECTED;this._2=new Faye.Channel.Set();this._g=0;this._p={};this._8={reconnect:this.RETRY,interval:1000*(this._f.interval||this.INTERVAL),timeout:1000*(this._f.timeout||this.CONNECTION_TIMEOUT)};if(Faye.Event)Faye.Event.on(Faye.ENV,'beforeunload',function(){if(Faye.indexOf(this._o,'autodisconnect')<0)this.disconnect()},this)},disable:function(a){this._o.push(a)},setHeader:function(a,b){this._z[a]=b},getClientId:function(){return this._0},getState:function(){switch(this._1){case this.UNCONNECTED:return'UNCONNECTED';case this.CONNECTING:return'CONNECTING';case this.CONNECTED:return'CONNECTED';case this.DISCONNECTED:return'DISCONNECTED'}},handshake:function(f,g){if(this._8.reconnect===this.NONE)return;if(this._1!==this.UNCONNECTED)return;this._1=this.CONNECTING;var h=this;this.info('Initiating handshake with ?',this.endpoint);this._9({channel:Faye.Channel.HANDSHAKE,version:Faye.BAYEUX_VERSION,supportedConnectionTypes:[this._a.connectionType]},function(b){if(b.successful){this._1=this.CONNECTED;this._0=b.clientId;var d=Faye.filter(b.supportedConnectionTypes,function(a){return Faye.indexOf(this._o,a)<0},this);this._A(d);this.info('Handshake successful: ?',this._0);this.subscribe(this._2.getKeys(),true);if(f)f.call(g)}else{this.info('Handshake unsuccessful');Faye.ENV.setTimeout(function(){h.handshake(f,g)},this._8.interval);this._1=this.UNCONNECTED}},this)},connect:function(a,b){if(this._8.reconnect===this.NONE)return;if(this._1===this.DISCONNECTED)return;if(this._1===this.UNCONNECTED)return this.handshake(function(){this.connect(a,b)},this);this.callback(a,b);if(this._1!==this.CONNECTED)return;this.info('Calling deferred actions for ?',this._0);this.setDeferredStatus('succeeded');this.setDeferredStatus('deferred');if(this._q)return;this._q=true;this.info('Initiating connection for ?',this._0);this._9({channel:Faye.Channel.CONNECT,clientId:this._0,connectionType:this._a.connectionType},this._B,this)},disconnect:function(){if(this._1!==this.CONNECTED)return;this._1=this.DISCONNECTED;this.info('Disconnecting ?',this._0);this._9({channel:Faye.Channel.DISCONNECT,clientId:this._0},function(a){if(a.successful)this._a.close()},this);this.info('Clearing channel listeners for ?',this._0);this._2=new Faye.Channel.Set()},subscribe:function(d,f,g){if(d instanceof Array)return Faye.map(d,function(c){return this.subscribe(c,f,g)},this);var h=new Faye.Subscription(this,d,f,g),j=(f===true),k=this._2.hasSubscription(d);if(k&&!j){this._2.subscribe([d],f,g);h.setDeferredStatus('succeeded');return h}this.connect(function(){this.info('Client ? attempting to subscribe to ?',this._0,d);if(!j)this._2.subscribe([d],f,g);this._9({channel:Faye.Channel.SUBSCRIBE,clientId:this._0,subscription:d},function(a){if(!a.successful){h.setDeferredStatus('failed',Faye.Error.parse(a.error));return this._2.unsubscribe(d,f,g)}var b=[].concat(a.subscription);this.info('Subscription acknowledged for ? to ?',this._0,b);h.setDeferredStatus('succeeded')},this)},this);return h},unsubscribe:function(d,f,g){if(d instanceof Array)return Faye.map(d,function(c){return this.unsubscribe(c,f,g)},this);var h=this._2.unsubscribe(d,f,g);if(!h)return;this.connect(function(){this.info('Client ? attempting to unsubscribe from ?',this._0,d);this._9({channel:Faye.Channel.UNSUBSCRIBE,clientId:this._0,subscription:d},function(a){if(!a.successful)return;var b=[].concat(a.subscription);this.info('Unsubscription acknowledged for ? from ?',this._0,b)},this)},this)},publish:function(b,d){var f=new Faye.Publication();this.connect(function(){this.info('Client ? queueing published message to ?: ?',this._0,b,d);this._9({channel:b,data:d,clientId:this._0},function(a){if(a.successful)f.setDeferredStatus('succeeded');else f.setDeferredStatus('failed',Faye.Error.parse(a.error))},this)},this);return f},receiveMessage:function(d){this.pipeThroughExtensions('incoming',d,function(a){if(!a)return;if(a.advice)this._F(a.advice);this._G(a);if(a.successful===undefined)return;var b=this._p[a.id];if(!b)return;delete this._p[a.id];b[0].call(b[1],a)},this)},_A:function(b){Faye.Transport.get(this,b,function(a){this.debug('Selected ? transport for ?',a.connectionType,a.endpoint);this._a=a;this._a.cookies=this._E;this._a.headers=this._z;a.bind('down',function(){if(this._b!==undefined&&!this._b)return;this._b=false;this.trigger('transport:down')},this);a.bind('up',function(){if(this._b!==undefined&&this._b)return;this._b=true;this.trigger('transport:up')},this)},this)},_9:function(b,d,f){b.id=this._H();if(d)this._p[b.id]=[d,f];this.pipeThroughExtensions('outgoing',b,function(a){if(!a)return;this._a.send(a,this._8.timeout/1000)},this)},_H:function(){this._g+=1;if(this._g>=Math.pow(2,32))this._g=0;return this._g.toString(36)},_F:function(a){Faye.extend(this._8,a);if(this._8.reconnect===this.HANDSHAKE&&this._1!==this.DISCONNECTED){this._1=this.UNCONNECTED;this._0=null;this._B()}},_G:function(a){if(!a.channel||a.data===undefined)return;this.info('Client ? calling listeners for ? with ?',this._0,a.channel,a.data);this._2.distributeMessage(a)},_I:function(){if(!this._q)return;this._q=null;this.info('Closed connection for ?',this._0)},_B:function(){this._I();var a=this;Faye.ENV.setTimeout(function(){a.connect()},this._8.interval)}});Faye.extend(Faye.Client.prototype,Faye.Deferrable);Faye.extend(Faye.Client.prototype,Faye.Publisher);Faye.extend(Faye.Client.prototype,Faye.Logging);Faye.extend(Faye.Client.prototype,Faye.Extensible);Faye.Transport=Faye.extend(Faye.Class({MAX_DELAY:0.0,batching:true,initialize:function(a,b){this._7=a;this.endpoint=b;this._c=[]},close:function(){},send:function(a,b){this.debug('Client ? sending message to ?: ?',this._7._0,this.endpoint,a);if(!this.batching)return this.request([a],b);this._c.push(a);this._J=b;if(a.channel===Faye.Channel.HANDSHAKE)return this.addTimeout('publish',0.01,this.flush,this);if(a.channel===Faye.Channel.CONNECT)this._r=a;if(this.shouldFlush&&this.shouldFlush(this._c))return this.flush();this.addTimeout('publish',this.MAX_DELAY,this.flush,this)},flush:function(){this.removeTimeout('publish');if(this._c.length>1&&this._r)this._r.advice={timeout:0};this.request(this._c,this._J);this._r=null;this._c=[]},receive:function(a){this.debug('Client ? received from ?: ?',this._7._0,this.endpoint,a);for(var b=0,d=a.length;b<d;b++){this._7.receiveMessage(a[b])}},retry:function(a,b){var d=false,f=this._7.retry*1000,g=this;return function(){if(d)return;d=true;Faye.ENV.setTimeout(function(){g.request(a,b)},f)}}}),{MAX_URL_LENGTH:2048,get:function(k,i,l,m){var n=k.endpoint;if(i===undefined)i=this.supportedConnectionTypes();Faye.asyncEach(this._s,function(d,f){var g=d[0],h=d[1],j=k.endpoints[g]||n;if(Faye.indexOf(i,g)<0){h.isUsable(k,j,function(){});return f()}h.isUsable(k,j,function(a){if(!a)return f();var b=h.hasOwnProperty('create')?h.create(k,j):new h(k,j);l.call(m,b)})},function(){throw new Error('Could not find a usable connection type for '+n);})},register:function(a,b){this._s.push([a,b]);b.prototype.connectionType=a},_s:[],supportedConnectionTypes:function(){return Faye.map(this._s,function(a){return a[0]})}});Faye.extend(Faye.Transport.prototype,Faye.Logging);Faye.extend(Faye.Transport.prototype,Faye.Publisher);Faye.extend(Faye.Transport.prototype,Faye.Timeouts);Faye.Event={_h:[],on:function(a,b,d,f){var g=function(){d.call(f)};if(a.addEventListener)a.addEventListener(b,g,false);else a.attachEvent('on'+b,g);this._h.push({_i:a,_t:b,_m:d,_n:f,_C:g})},detach:function(a,b,d,f){var g=this._h.length,h;while(g--){h=this._h[g];if((a&&a!==h._i)||(b&&b!==h._t)||(d&&d!==h._m)||(f&&f!==h._n))continue;if(h._i.removeEventListener)h._i.removeEventListener(h._t,h._C,false);else h._i.detachEvent('on'+h._t,h._C);this._h.splice(g,1);h=null}}};Faye.Event.on(Faye.ENV,'unload',Faye.Event.detach,Faye.Event);Faye.URI=Faye.extend(Faye.Class({queryString:function(){var a=[];for(var b in this.params){if(!this.params.hasOwnProperty(b))continue;a.push(encodeURIComponent(b)+'='+encodeURIComponent(this.params[b]))}return a.join('&')},isSameOrigin:function(){var a=Faye.URI.parse(Faye.ENV.location.href);var b=(a.hostname!==this.hostname)||(a.port!==this.port)||(a.protocol!==this.protocol);return!b},toURL:function(){var a=this.queryString();return this.protocol+'//'+this.hostname+(this.port?':'+this.port:'')+this.pathname+(a?'?'+a:'')+this.hash}}),{parse:function(f,g){if(typeof f!=='string')return f;var h=new this(),j;var k=function(b,d){f=f.replace(d,function(a){h[b]=a;return''});if(h[b]===undefined)h[b]=Faye.ENV.location[b]};k('protocol',/^https?\:/);k('host',/^\/\/[^\/]+/);if(!/^\//.test(f))f=Faye.ENV.location.pathname.replace(/[^\/]*$/,'')+f;k('pathname',/^\/[^\?#]*/);k('search',/^\?[^#]*/);k('hash',/^#.*/);if(/^\/\//.test(h.host)){h.host=h.host.substr(2);j=h.host.split(':');h.hostname=j[0];h.port=j[1]||''}else{h.hostname=Faye.ENV.location.hostname;h.port=Faye.ENV.location.port}var i=h.search.replace(/^\?/,''),l=i?i.split('&'):[],m=l.length,n={};while(m--){j=l[m].split('=');n[decodeURIComponent(j[0]||'')]=decodeURIComponent(j[1]||'')}if(typeof g==='object')Faye.extend(n,g);h.params=n;return h}});if(!this.JSON){JSON={}}(function(){function l(a){return a<10?'0'+a:a}if(typeof Date.prototype.toJSON!=='function'){Date.prototype.toJSON=function(a){return this.getUTCFullYear()+'-'+l(this.getUTCMonth()+1)+'-'+l(this.getUTCDate())+'T'+l(this.getUTCHours())+':'+l(this.getUTCMinutes())+':'+l(this.getUTCSeconds())+'Z'};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(a){return this.valueOf()}}var m=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,n=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,o,q,t={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},p;function s(d){n.lastIndex=0;return n.test(d)?'"'+d.replace(n,function(a){var b=t[a];return typeof b==='string'?b:'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+d+'"'}function r(a,b){var d,f,g,h,j=o,k,i=b[a];if(i&&typeof i==='object'&&typeof i.toJSON==='function'){i=i.toJSON(a)}if(typeof p==='function'){i=p.call(b,a,i)}switch(typeof i){case'string':return s(i);case'number':return isFinite(i)?String(i):'null';case'boolean':case'null':return String(i);case'object':if(!i){return'null'}o+=q;k=[];if(Object.prototype.toString.apply(i)==='[object Array]'){h=i.length;for(d=0;d<h;d+=1){k[d]=r(d,i)||'null'}g=k.length===0?'[]':o?'[\n'+o+k.join(',\n'+o)+'\n'+j+']':'['+k.join(',')+']';o=j;return g}if(p&&typeof p==='object'){h=p.length;for(d=0;d<h;d+=1){f=p[d];if(typeof f==='string'){g=r(f,i);if(g){k.push(s(f)+(o?': ':':')+g)}}}}else{for(f in i){if(Object.hasOwnProperty.call(i,f)){g=r(f,i);if(g){k.push(s(f)+(o?': ':':')+g)}}}}g=k.length===0?'{}':o?'{\n'+o+k.join(',\n'+o)+'\n'+j+'}':'{'+k.join(',')+'}';o=j;return g}}Faye.stringify=function(a,b,d){var f;o='';q='';if(typeof d==='number'){for(f=0;f<d;f+=1){q+=' '}}else if(typeof d==='string'){q=d}p=b;if(b&&typeof b!=='function'&&(typeof b!=='object'||typeof b.length!=='number')){throw new Error('JSON.stringify');}return r('',{'':a})};if(typeof JSON.stringify!=='function'){JSON.stringify=Faye.stringify}if(typeof JSON.parse!=='function'){JSON.parse=function(h,j){var k;function i(a,b){var d,f,g=a[b];if(g&&typeof g==='object'){for(d in g){if(Object.hasOwnProperty.call(g,d)){f=i(g,d);if(f!==undefined){g[d]=f}else{delete g[d]}}}}return j.call(a,b,g)}m.lastIndex=0;if(m.test(h)){h=h.replace(m,function(a){return'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4)})}if(/^[\],:{}\s]*$/.test(h.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,'@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']').replace(/(?:^|:|,)(?:\s*\[)+/g,''))){k=eval('('+h+')');return typeof j==='function'?i({'':k},''):k}throw new SyntaxError('JSON.parse');}}}());Faye.Transport.WebSocket=Faye.extend(Faye.Class(Faye.Transport,{UNCONNECTED:1,CONNECTING:2,CONNECTED:3,batching:false,isUsable:function(a,b){this.callback(function(){a.call(b,true)});this.errback(function(){a.call(b,false)});this.connect()},request:function(b,d){if(b.length===0)return;this._d=this._d||{};for(var f=0,g=b.length;f<g;f++){this._d[b[f].id]=b[f]}this.callback(function(a){a.send(Faye.toJSON(b))});this.connect()},close:function(){if(this._D)return;this._D=true;if(this._4)this._4.close()},connect:function(){if(Faye.Transport.WebSocket._K)return;if(this._D)return;this._1=this._1||this.UNCONNECTED;if(this._1!==this.UNCONNECTED)return;this._1=this.CONNECTING;var g=Faye.Transport.WebSocket.getClass();if(!g)return this.setDeferredStatus('failed');this._4=new g(Faye.Transport.WebSocket.getSocketUrl(this.endpoint));var h=this;this._4.onopen=function(){h._1=h.CONNECTED;h._u=true;h.setDeferredStatus('succeeded',h._4);h.trigger('up')};this._4.onmessage=function(a){var b=[].concat(JSON.parse(a.data));for(var d=0,f=b.length;d<f;d++){delete h._d[b[d].id]}h.receive(b)};this._4.onclose=function(){var a=(h._1===h.CONNECTED);h.setDeferredStatus('deferred');h._1=h.UNCONNECTED;delete h._4;if(a)return h.resend();if(!h._u)return h.setDeferredStatus('failed');var b=h._7.retry*1000;Faye.ENV.setTimeout(function(){h.connect()},b);h.trigger('down')}},resend:function(){if(!this._d)return;var d=Faye.map(this._d,function(a,b){return b});this.request(d)}}),{getSocketUrl:function(a){if(Faye.URI)a=Faye.URI.parse(a).toURL();return a.replace(/^http(s?):/ig,'ws$1:')},getClass:function(){return(Faye.WebSocket&&Faye.WebSocket.Client)||Faye.ENV.WebSocket||Faye.ENV.MozWebSocket},isUsable:function(a,b,d,f){this.create(a,b).isUsable(d,f)},create:function(a,b){var d=a.transports.websocket=a.transports.websocket||{};d[b]=d[b]||new this(a,b);return d[b]}});Faye.extend(Faye.Transport.WebSocket.prototype,Faye.Deferrable);Faye.Transport.register('websocket',Faye.Transport.WebSocket);if(Faye.Event)Faye.Event.on(Faye.ENV,'beforeunload',function(){Faye.Transport.WebSocket._K=true});Faye.Transport.EventSource=Faye.extend(Faye.Class(Faye.Transport,{initialize:function(b,d){Faye.Transport.prototype.initialize.call(this,b,d);if(!Faye.ENV.EventSource)return this.setDeferredStatus('failed');this._L=new Faye.Transport.XHR(b,d);var f=new EventSource(d+'/'+b.getClientId()),g=this;f.onopen=function(){g._u=true;g.setDeferredStatus('succeeded');g.trigger('up')};f.onerror=function(){if(g._u){g.trigger('down')}else{g.setDeferredStatus('failed');f.close()}};f.onmessage=function(a){g.receive(JSON.parse(a.data));g.trigger('up')};this._4=f},isUsable:function(a,b){this.callback(function(){a.call(b,true)});this.errback(function(){a.call(b,false)})},request:function(a,b){this._L.request(a,b)},close:function(){this._4.close()}}),{isUsable:function(b,d,f,g){var h=b.getClientId();if(!h)return f.call(g,false);Faye.Transport.XHR.isUsable(b,d,function(a){if(!a)return f.call(g,false);this.create(b,d).isUsable(f,g)},this)},create:function(a,b){var d=a.transports.eventsource=a.transports.eventsource||{};d[b]=d[b]||new this(a,b);return d[b]}});Faye.extend(Faye.Transport.EventSource.prototype,Faye.Deferrable);Faye.Transport.register('eventsource',Faye.Transport.EventSource);Faye.Transport.XHR=Faye.extend(Faye.Class(Faye.Transport,{request:function(f,g){var h=this.retry(f,g),j=Faye.URI.parse(this.endpoint).pathname,k=this,i=Faye.ENV.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();i.open('POST',j,true);i.setRequestHeader('Content-Type','application/json');i.setRequestHeader('Pragma','no-cache');i.setRequestHeader('X-Requested-With','XMLHttpRequest');var l=this.headers;for(var m in l){if(!l.hasOwnProperty(m))continue;i.setRequestHeader(m,l[m])}var n=function(){i.abort()};Faye.Event.on(Faye.ENV,'beforeunload',n);var o=function(){Faye.Event.detach(Faye.ENV,'beforeunload',n);i.onreadystatechange=function(){};i=null};i.onreadystatechange=function(){if(i.readyState!==4)return;var a=null,b=i.status,d=((b>=200&&b<300)||b===304||b===1223);if(!d){o();h();return k.trigger('down')}try{a=JSON.parse(i.responseText)}catch(e){}o();if(a){k.receive(a);k.trigger('up')}else{h();k.trigger('down')}};i.send(Faye.toJSON(f))}}),{isUsable:function(a,b,d,f){d.call(f,Faye.URI.parse(b).isSameOrigin())}});Faye.Transport.register('long-polling',Faye.Transport.XHR);Faye.Transport.CORS=Faye.extend(Faye.Class(Faye.Transport,{request:function(b,d){var f=Faye.ENV.XDomainRequest?XDomainRequest:XMLHttpRequest,g=new f(),h=this.retry(b,d),j=this;g.open('POST',this.endpoint,true);if(g.setRequestHeader)g.setRequestHeader('Pragma','no-cache');var k=function(){if(!g)return false;g.onload=g.onerror=g.ontimeout=g.onprogress=null;g=null;Faye.ENV.clearTimeout(l);return true};g.onload=function(){var a=null;try{a=JSON.parse(g.responseText)}catch(e){}k();if(a){j.receive(a);j.trigger('up')}else{h();j.trigger('down')}};var i=function(){k();h();j.trigger('down')};var l=Faye.ENV.setTimeout(i,1.5*1000*d);g.onerror=i;g.ontimeout=i;g.onprogress=function(){};g.send('message='+encodeURIComponent(Faye.toJSON(b)))}}),{isUsable:function(a,b,d,f){if(Faye.URI.parse(b).isSameOrigin())return d.call(f,false);if(Faye.ENV.XDomainRequest)return d.call(f,Faye.URI.parse(b).protocol===Faye.URI.parse(Faye.ENV.location).protocol);if(Faye.ENV.XMLHttpRequest){var g=new Faye.ENV.XMLHttpRequest();return d.call(f,g.withCredentials!==undefined)}return d.call(f,false)}});Faye.Transport.register('cross-origin-long-polling',Faye.Transport.CORS);Faye.Transport.JSONP=Faye.extend(Faye.Class(Faye.Transport,{shouldFlush:function(a){var b={message:Faye.toJSON(a),jsonp:'__jsonp'+Faye.Transport.JSONP._v+'__'};var d=Faye.URI.parse(this.endpoint,b).toURL();return d.length>=Faye.Transport.MAX_URL_LENGTH},request:function(b,d){var f={message:Faye.toJSON(b)},g=document.getElementsByTagName('head')[0],h=document.createElement('script'),j=Faye.Transport.JSONP.getCallbackName(),k=Faye.URI.parse(this.endpoint,f),i=this.retry(b,d),l=this;Faye.ENV[j]=function(a){n();l.receive(a);l.trigger('up')};var m=Faye.ENV.setTimeout(function(){n();i();l.trigger('down')},1.5*1000*d);var n=function(){if(!Faye.ENV[j])return false;Faye.ENV[j]=undefined;try{delete Faye.ENV[j]}catch(e){}Faye.ENV.clearTimeout(m);h.parentNode.removeChild(h);return true};k.params.jsonp=j;h.type='text/javascript';h.src=k.toURL();g.appendChild(h)}}),{_v:0,getCallbackName:function(){this._v+=1;return'__jsonp'+this._v+'__'},isUsable:function(a,b,d,f){d.call(f,true)}});Faye.Transport.register('callback-polling',Faye.Transport.JSONP);
|
2
2
|
//@ sourceMappingURL=faye-browser-min.js.map
|
data/lib/faye-browser-min.js.map
CHANGED
@@ -3,6 +3,6 @@
|
|
3
3
|
"file": "faye-browser-min.js",
|
4
4
|
"sourceRoot": "",
|
5
5
|
"sources": ["faye-browser.js"],
|
6
|
-
"names": ["_advice", "_callback", "_callbacks", "_cancelled", "_cbCount", "_channels", "_client", "_clientId", "_closed", "_connectMessage", "_connectRequest", "_context", "_cookies", "_cycleConnection", "_deferredArgs", "_deferredStatus", "_deliverMessage", "_disabled", "_element", "
|
7
|
-
"mappings": "AAAA,IAAI,MAAQ,OAAO,QAAU,SAAW,QACxC,GAAI,OAAO,UAAY,WAAY,OAAO,KAAO,KAEjD,KAAK,OAAS,SAASiF,EAAM2F,EAAQ9B,GACnC,IAAK8B,EAAQ,OAAO3F,EACpB,IAAK,IAAI4B,EAAI,GAAG+D,GACd,IAAKA,EAAO,eAAe/D,GAAM,SACjC,GAAI5B,EAAK,eAAe4B,IAAQiC,IAAc,MAAO,SACrD,GAAI7D,EAAK4B,KAAS+D,EAAO/D,GACvB5B,EAAK4B,GAAO+D,EAAO/D,GAEvB,OAAO5B,GAGT,KAAK,OAAO,MACV,gBAEA,qBACA,cACA,gBAAmB,eACnB,mBAAoB,KAAK,UAAW,MAAM,OAAO,KAAK,UAAW,SAAS,UAAW,YAAa,cAAe,GAAG,UAEpH,6BAA8B,KAAK,UAAW,SAAS,UAAW,GAAG,UAErE,KAAM,WAAa,OAAO,SAE1B,OAAQ,SAAS1B,GACfA,EAAYA,GAAa,KAAK,UAC9B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KA,IAAY,KAGtC,SAAU,SAAS+E,EAAUzB,EAAUe,GACrCf,EAAS,KAAKe,EAAS,SAI3B,KAAK,UAAU,UAAU,SAAS,SAAU,KAAK,UAAU;"
|
6
|
+
"names": ["_advice", "_callback", "_callbacks", "_cancelled", "_cbCount", "_channels", "_client", "_clientId", "_closed", "_connectMessage", "_connectRequest", "_context", "_cookies", "_cycleConnection", "_deferredArgs", "_deferredStatus", "_deliverMessage", "_disabled", "_element", "_errbacks", "_everConnected", "_extensions", "_generateMessageId", "_handleAdvice", "_handler", "_headers", "_messageId", "_messages", "_options", "_outbox", "_registry", "_responseCallbacks", "_selectTransport", "_send", "_socket", "_state", "_subscribers", "_teardownConnection", "_this", "_timeout", "_timeouts", "_timer", "_transport", "_transportUp", "_transports", "_type", "_unloaded", "_used", "_xhr", "abort", "advice", "args", "array", "banner", "bitlength", "bridge", "c", "callback", "callbackName", "callbacks", "called", "calls", "channel", "channels", "chars", "cleanUp", "client", "clone", "code", "connEndpoint", "connType", "connectionTypes", "consume", "context", "copy", "cx", "data", "date", "day", "dead", "delay", "dest", "element", "endpoint", "escapable", "event", "eventName", "eventType", "extension", "extensions", "external", "f", "feature", "first", "force", "gap", "hasSubscribe", "head", "headers", "holder", "host", "hour", "i", "id", "indent", "isUsable", "iterate", "iterator", "j", "k", "key", "keys", "klass", "length", "level", "levels", "limit", "list", "lista", "listb", "listener", "listeners", "location", "loop", "looping", "match", "maxSize", "message", "messageArgs", "messages", "meta", "methods", "mind", "minute", "month", "msg", "n", "name", "names", "needle", "object", "onerror", "options", "overwrite", "pad", "pair", "pairs", "params", "parent", "parsedMessage", "partial", "parts", "path", "pattern", "pipe", "publication", "query", "quote", "register", "rep", "replacer", "response", "responses", "result", "resume", "retry", "reviver", "script", "second", "seconds", "segments", "self", "socket", "sockets", "source", "space", "stage", "status", "str", "string", "subscription", "successful", "text", "timeout", "timer", "transport", "transportTypes", "type", "uri", "url", "usable", "v", "value", "walk", "wasConnected", "wrapped", "ws", "xh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AU,UAAU,SAAS,SAAU,KAAK,UAAU;"
|
8
8
|
}
|
data/lib/faye-browser.js
CHANGED
@@ -13,10 +13,10 @@ Faye.extend = function(dest, source, overwrite) {
|
|
13
13
|
};
|
14
14
|
|
15
15
|
Faye.extend(Faye, {
|
16
|
-
VERSION: '0.8.
|
16
|
+
VERSION: '0.8.4',
|
17
17
|
|
18
18
|
BAYEUX_VERSION: '1.0',
|
19
|
-
ID_LENGTH:
|
19
|
+
ID_LENGTH: 160,
|
20
20
|
JSONP_CALLBACK: 'jsonpcallback',
|
21
21
|
CONNECTION_TYPES: ['long-polling', 'cross-origin-long-polling', 'callback-polling', 'websocket', 'eventsource', 'in-process'],
|
22
22
|
|
@@ -30,7 +30,9 @@ Faye.extend(Faye, {
|
|
30
30
|
var parts = Math.ceil(bitlength / 32),
|
31
31
|
string = '';
|
32
32
|
while (parts--) string += this.random(32);
|
33
|
-
|
33
|
+
var chars = string.split(''), result = '';
|
34
|
+
while (chars.length > 0) result += chars.pop();
|
35
|
+
return result;
|
34
36
|
}
|
35
37
|
var limit = Math.pow(2, bitlength) - 1,
|
36
38
|
maxSize = limit.toString(36).length,
|
@@ -718,6 +720,7 @@ Faye.Client = Faye.Class({
|
|
718
720
|
this._options = options || {};
|
719
721
|
this.endpoint = endpoint || this.DEFAULT_ENDPOINT;
|
720
722
|
this.endpoints = this._options.endpoints || {};
|
723
|
+
this.transports = {};
|
721
724
|
this._cookies = Faye.CookieJar && new Faye.CookieJar();
|
722
725
|
this._headers = {};
|
723
726
|
this._disabled = [];
|
@@ -1015,6 +1018,8 @@ Faye.Client = Faye.Class({
|
|
1015
1018
|
|
1016
1019
|
_selectTransport: function(transportTypes) {
|
1017
1020
|
Faye.Transport.get(this, transportTypes, function(transport) {
|
1021
|
+
this.debug('Selected ? transport for ?', transport.connectionType, transport.endpoint);
|
1022
|
+
|
1018
1023
|
this._transport = transport;
|
1019
1024
|
this._transport.cookies = this._cookies;
|
1020
1025
|
this._transport.headers = this._headers;
|
@@ -1089,17 +1094,16 @@ Faye.Transport = Faye.extend(Faye.Class({
|
|
1089
1094
|
batching: true,
|
1090
1095
|
|
1091
1096
|
initialize: function(client, endpoint) {
|
1092
|
-
this.
|
1093
|
-
this.
|
1094
|
-
this.
|
1095
|
-
this._outbox = [];
|
1097
|
+
this._client = client;
|
1098
|
+
this.endpoint = endpoint;
|
1099
|
+
this._outbox = [];
|
1096
1100
|
},
|
1097
1101
|
|
1098
1102
|
close: function() {},
|
1099
1103
|
|
1100
1104
|
send: function(message, timeout) {
|
1101
1105
|
this.debug('Client ? sending message to ?: ?',
|
1102
|
-
this._client._clientId, this.
|
1106
|
+
this._client._clientId, this.endpoint, message);
|
1103
1107
|
|
1104
1108
|
if (!this.batching) return this.request([message], timeout);
|
1105
1109
|
|
@@ -1107,11 +1111,14 @@ Faye.Transport = Faye.extend(Faye.Class({
|
|
1107
1111
|
this._timeout = timeout;
|
1108
1112
|
|
1109
1113
|
if (message.channel === Faye.Channel.HANDSHAKE)
|
1110
|
-
return this.flush
|
1114
|
+
return this.addTimeout('publish', 0.01, this.flush, this);
|
1111
1115
|
|
1112
1116
|
if (message.channel === Faye.Channel.CONNECT)
|
1113
1117
|
this._connectMessage = message;
|
1114
1118
|
|
1119
|
+
if (this.shouldFlush && this.shouldFlush(this._outbox))
|
1120
|
+
return this.flush();
|
1121
|
+
|
1115
1122
|
this.addTimeout('publish', this.MAX_DELAY, this.flush, this);
|
1116
1123
|
},
|
1117
1124
|
|
@@ -1129,7 +1136,7 @@ Faye.Transport = Faye.extend(Faye.Class({
|
|
1129
1136
|
|
1130
1137
|
receive: function(responses) {
|
1131
1138
|
this.debug('Client ? received from ?: ?',
|
1132
|
-
this._client._clientId, this.
|
1139
|
+
this._client._clientId, this.endpoint, responses);
|
1133
1140
|
|
1134
1141
|
for (var i = 0, n = responses.length; i < n; i++) {
|
1135
1142
|
this._client.receiveMessage(responses[i]);
|
@@ -1149,6 +1156,8 @@ Faye.Transport = Faye.extend(Faye.Class({
|
|
1149
1156
|
}
|
1150
1157
|
|
1151
1158
|
}), {
|
1159
|
+
MAX_URL_LENGTH: 2048,
|
1160
|
+
|
1152
1161
|
get: function(client, connectionTypes, callback, context) {
|
1153
1162
|
var endpoint = client.endpoint;
|
1154
1163
|
if (connectionTypes === undefined) connectionTypes = this.supportedConnectionTypes();
|
@@ -1157,11 +1166,15 @@ Faye.Transport = Faye.extend(Faye.Class({
|
|
1157
1166
|
var connType = pair[0], klass = pair[1],
|
1158
1167
|
connEndpoint = client.endpoints[connType] || endpoint;
|
1159
1168
|
|
1160
|
-
if (Faye.indexOf(connectionTypes, connType) < 0)
|
1169
|
+
if (Faye.indexOf(connectionTypes, connType) < 0) {
|
1170
|
+
klass.isUsable(client, connEndpoint, function() {});
|
1171
|
+
return resume();
|
1172
|
+
}
|
1161
1173
|
|
1162
|
-
klass.isUsable(connEndpoint, function(isUsable) {
|
1163
|
-
if (isUsable)
|
1164
|
-
|
1174
|
+
klass.isUsable(client, connEndpoint, function(isUsable) {
|
1175
|
+
if (!isUsable) return resume();
|
1176
|
+
var transport = klass.hasOwnProperty('create') ? klass.create(client, connEndpoint) : new klass(client, connEndpoint);
|
1177
|
+
callback.call(context, transport);
|
1165
1178
|
});
|
1166
1179
|
}, function() {
|
1167
1180
|
throw new Error('Could not find a usable connection type for ' + endpoint);
|
@@ -1240,7 +1253,7 @@ Faye.URI = Faye.extend(Faye.Class({
|
|
1240
1253
|
return pairs.join('&');
|
1241
1254
|
},
|
1242
1255
|
|
1243
|
-
|
1256
|
+
isSameOrigin: function() {
|
1244
1257
|
var host = Faye.URI.parse(Faye.ENV.location.href);
|
1245
1258
|
|
1246
1259
|
var external = (host.hostname !== this.hostname) ||
|
@@ -1252,32 +1265,44 @@ Faye.URI = Faye.extend(Faye.Class({
|
|
1252
1265
|
|
1253
1266
|
toURL: function() {
|
1254
1267
|
var query = this.queryString();
|
1255
|
-
return this.protocol + this.hostname + (this.port ? ':' + this.port : '') +
|
1256
|
-
this.pathname + (query ? '?' + query : '');
|
1268
|
+
return this.protocol + '//' + this.hostname + (this.port ? ':' + this.port : '') +
|
1269
|
+
this.pathname + (query ? '?' + query : '') + this.hash;
|
1257
1270
|
}
|
1258
1271
|
}), {
|
1259
1272
|
parse: function(url, params) {
|
1260
1273
|
if (typeof url !== 'string') return url;
|
1274
|
+
var uri = new this(), parts;
|
1261
1275
|
|
1262
|
-
var
|
1263
|
-
|
1276
|
+
var consume = function(name, pattern) {
|
1277
|
+
url = url.replace(pattern, function(match) {
|
1278
|
+
uri[name] = match;
|
1279
|
+
return '';
|
1280
|
+
});
|
1281
|
+
if (uri[name] === undefined) uri[name] = Faye.ENV.location[name];
|
1282
|
+
};
|
1264
1283
|
|
1265
|
-
|
1284
|
+
consume('protocol', /^https?\:/);
|
1285
|
+
consume('host', /^\/\/[^\/]+/);
|
1266
1286
|
|
1267
|
-
|
1268
|
-
|
1269
|
-
|
1287
|
+
if (!/^\//.test(url)) url = Faye.ENV.location.pathname.replace(/[^\/]*$/, '') + url;
|
1288
|
+
consume('pathname', /^\/[^\?#]*/);
|
1289
|
+
consume('search', /^\?[^#]*/);
|
1290
|
+
consume('hash', /^#.*/);
|
1270
1291
|
|
1271
|
-
if (
|
1272
|
-
uri.
|
1273
|
-
|
1274
|
-
uri.
|
1292
|
+
if (/^\/\//.test(uri.host)) {
|
1293
|
+
uri.host = uri.host.substr(2);
|
1294
|
+
parts = uri.host.split(':');
|
1295
|
+
uri.hostname = parts[0];
|
1296
|
+
uri.port = parts[1] || '';
|
1297
|
+
} else {
|
1298
|
+
uri.hostname = Faye.ENV.location.hostname;
|
1299
|
+
uri.port = Faye.ENV.location.port;
|
1300
|
+
}
|
1275
1301
|
|
1276
|
-
var query =
|
1302
|
+
var query = uri.search.replace(/^\?/, ''),
|
1277
1303
|
pairs = query ? query.split('&') : [],
|
1278
1304
|
n = pairs.length,
|
1279
|
-
data = {}
|
1280
|
-
parts;
|
1305
|
+
data = {};
|
1281
1306
|
|
1282
1307
|
while (n--) {
|
1283
1308
|
parts = pairs[n].split('=');
|
@@ -1784,6 +1809,12 @@ Faye.Transport.WebSocket = Faye.extend(Faye.Class(Faye.Transport, {
|
|
1784
1809
|
|
1785
1810
|
batching: false,
|
1786
1811
|
|
1812
|
+
isUsable: function(callback, context) {
|
1813
|
+
this.callback(function() { callback.call(context, true) });
|
1814
|
+
this.errback(function() { callback.call(context, false) });
|
1815
|
+
this.connect();
|
1816
|
+
},
|
1817
|
+
|
1787
1818
|
request: function(messages, timeout) {
|
1788
1819
|
if (messages.length === 0) return;
|
1789
1820
|
this._messages = this._messages || {};
|
@@ -1791,11 +1822,7 @@ Faye.Transport.WebSocket = Faye.extend(Faye.Class(Faye.Transport, {
|
|
1791
1822
|
for (var i = 0, n = messages.length; i < n; i++) {
|
1792
1823
|
this._messages[messages[i].id] = messages[i];
|
1793
1824
|
}
|
1794
|
-
this.
|
1795
|
-
},
|
1796
|
-
|
1797
|
-
withSocket: function(callback, context) {
|
1798
|
-
this.callback(callback, context);
|
1825
|
+
this.callback(function(socket) { socket.send(Faye.toJSON(messages)) });
|
1799
1826
|
this.connect();
|
1800
1827
|
},
|
1801
1828
|
|
@@ -1815,11 +1842,14 @@ Faye.Transport.WebSocket = Faye.extend(Faye.Class(Faye.Transport, {
|
|
1815
1842
|
this._state = this.CONNECTING;
|
1816
1843
|
|
1817
1844
|
var ws = Faye.Transport.WebSocket.getClass();
|
1818
|
-
|
1845
|
+
if (!ws) return this.setDeferredStatus('failed');
|
1846
|
+
|
1847
|
+
this._socket = new ws(Faye.Transport.WebSocket.getSocketUrl(this.endpoint));
|
1819
1848
|
var self = this;
|
1820
1849
|
|
1821
1850
|
this._socket.onopen = function() {
|
1822
1851
|
self._state = self.CONNECTED;
|
1852
|
+
self._everConnected = true;
|
1823
1853
|
self.setDeferredStatus('succeeded', self._socket);
|
1824
1854
|
self.trigger('up');
|
1825
1855
|
};
|
@@ -1839,6 +1869,7 @@ Faye.Transport.WebSocket = Faye.extend(Faye.Class(Faye.Transport, {
|
|
1839
1869
|
delete self._socket;
|
1840
1870
|
|
1841
1871
|
if (wasConnected) return self.resend();
|
1872
|
+
if (!self._everConnected) return self.setDeferredStatus('failed');
|
1842
1873
|
|
1843
1874
|
var retry = self._client.retry * 1000;
|
1844
1875
|
Faye.ENV.setTimeout(function() { self.connect() }, retry);
|
@@ -1847,12 +1878,11 @@ Faye.Transport.WebSocket = Faye.extend(Faye.Class(Faye.Transport, {
|
|
1847
1878
|
},
|
1848
1879
|
|
1849
1880
|
resend: function() {
|
1881
|
+
if (!this._messages) return;
|
1850
1882
|
var messages = Faye.map(this._messages, function(id, msg) { return msg });
|
1851
1883
|
this.request(messages);
|
1852
1884
|
}
|
1853
1885
|
}), {
|
1854
|
-
WEBSOCKET_TIMEOUT: 1000,
|
1855
|
-
|
1856
1886
|
getSocketUrl: function(endpoint) {
|
1857
1887
|
if (Faye.URI) endpoint = Faye.URI.parse(endpoint).toURL();
|
1858
1888
|
return endpoint.replace(/^http(s?):/ig, 'ws$1:');
|
@@ -1864,30 +1894,14 @@ Faye.Transport.WebSocket = Faye.extend(Faye.Class(Faye.Transport, {
|
|
1864
1894
|
Faye.ENV.MozWebSocket;
|
1865
1895
|
},
|
1866
1896
|
|
1867
|
-
isUsable: function(endpoint, callback, context) {
|
1868
|
-
|
1869
|
-
|
1870
|
-
|
1871
|
-
|
1872
|
-
|
1873
|
-
|
1874
|
-
|
1875
|
-
|
1876
|
-
socket.onopen = function() {
|
1877
|
-
connected = true;
|
1878
|
-
socket.close();
|
1879
|
-
callback.call(context, true);
|
1880
|
-
called = true;
|
1881
|
-
socket = null;
|
1882
|
-
};
|
1883
|
-
|
1884
|
-
var notconnected = function() {
|
1885
|
-
if (!called && !connected) callback.call(context, false);
|
1886
|
-
called = true;
|
1887
|
-
};
|
1888
|
-
|
1889
|
-
socket.onclose = socket.onerror = notconnected;
|
1890
|
-
Faye.ENV.setTimeout(notconnected, this.WEBSOCKET_TIMEOUT);
|
1897
|
+
isUsable: function(client, endpoint, callback, context) {
|
1898
|
+
this.create(client, endpoint).isUsable(callback, context);
|
1899
|
+
},
|
1900
|
+
|
1901
|
+
create: function(client, endpoint) {
|
1902
|
+
var sockets = client.transports.websocket = client.transports.websocket || {};
|
1903
|
+
sockets[endpoint] = sockets[endpoint] || new this(client, endpoint);
|
1904
|
+
return sockets[endpoint];
|
1891
1905
|
}
|
1892
1906
|
});
|
1893
1907
|
|
@@ -1903,26 +1917,41 @@ if (Faye.Event)
|
|
1903
1917
|
Faye.Transport.EventSource = Faye.extend(Faye.Class(Faye.Transport, {
|
1904
1918
|
initialize: function(client, endpoint) {
|
1905
1919
|
Faye.Transport.prototype.initialize.call(this, client, endpoint);
|
1920
|
+
if (!Faye.ENV.EventSource) return this.setDeferredStatus('failed');
|
1921
|
+
|
1906
1922
|
this._xhr = new Faye.Transport.XHR(client, endpoint);
|
1907
1923
|
|
1908
1924
|
var socket = new EventSource(endpoint + '/' + client.getClientId()),
|
1909
1925
|
self = this;
|
1910
1926
|
|
1911
1927
|
socket.onopen = function() {
|
1928
|
+
self._everConnected = true;
|
1929
|
+
self.setDeferredStatus('succeeded');
|
1912
1930
|
self.trigger('up');
|
1913
1931
|
};
|
1914
1932
|
|
1915
1933
|
socket.onerror = function() {
|
1916
|
-
self.
|
1934
|
+
if (self._everConnected) {
|
1935
|
+
self.trigger('down');
|
1936
|
+
} else {
|
1937
|
+
self.setDeferredStatus('failed');
|
1938
|
+
socket.close();
|
1939
|
+
}
|
1917
1940
|
};
|
1918
1941
|
|
1919
1942
|
socket.onmessage = function(event) {
|
1920
1943
|
self.receive(JSON.parse(event.data));
|
1944
|
+
self.trigger('up');
|
1921
1945
|
};
|
1922
1946
|
|
1923
1947
|
this._socket = socket;
|
1924
1948
|
},
|
1925
1949
|
|
1950
|
+
isUsable: function(callback, context) {
|
1951
|
+
this.callback(function() { callback.call(context, true) });
|
1952
|
+
this.errback(function() { callback.call(context, false) });
|
1953
|
+
},
|
1954
|
+
|
1926
1955
|
request: function(message, timeout) {
|
1927
1956
|
this._xhr.request(message, timeout);
|
1928
1957
|
},
|
@@ -1931,20 +1960,31 @@ Faye.Transport.EventSource = Faye.extend(Faye.Class(Faye.Transport, {
|
|
1931
1960
|
this._socket.close();
|
1932
1961
|
}
|
1933
1962
|
}), {
|
1934
|
-
isUsable: function(endpoint, callback, context) {
|
1935
|
-
|
1936
|
-
|
1937
|
-
|
1963
|
+
isUsable: function(client, endpoint, callback, context) {
|
1964
|
+
var id = client.getClientId();
|
1965
|
+
if (!id) return callback.call(context, false);
|
1966
|
+
|
1967
|
+
Faye.Transport.XHR.isUsable(client, endpoint, function(usable) {
|
1968
|
+
if (!usable) return callback.call(context, false);
|
1969
|
+
this.create(client, endpoint).isUsable(callback, context);
|
1970
|
+
}, this);
|
1971
|
+
},
|
1972
|
+
|
1973
|
+
create: function(client, endpoint) {
|
1974
|
+
var sockets = client.transports.eventsource = client.transports.eventsource || {};
|
1975
|
+
sockets[endpoint] = sockets[endpoint] || new this(client, endpoint);
|
1976
|
+
return sockets[endpoint];
|
1938
1977
|
}
|
1939
1978
|
});
|
1940
1979
|
|
1980
|
+
Faye.extend(Faye.Transport.EventSource.prototype, Faye.Deferrable);
|
1941
1981
|
Faye.Transport.register('eventsource', Faye.Transport.EventSource);
|
1942
1982
|
|
1943
1983
|
|
1944
1984
|
Faye.Transport.XHR = Faye.extend(Faye.Class(Faye.Transport, {
|
1945
1985
|
request: function(message, timeout) {
|
1946
1986
|
var retry = this.retry(message, timeout),
|
1947
|
-
path = Faye.URI.parse(this.
|
1987
|
+
path = Faye.URI.parse(this.endpoint).pathname,
|
1948
1988
|
self = this,
|
1949
1989
|
xhr = Faye.ENV.ActiveXObject
|
1950
1990
|
? new ActiveXObject("Microsoft.XMLHTTP")
|
@@ -1952,6 +1992,7 @@ Faye.Transport.XHR = Faye.extend(Faye.Class(Faye.Transport, {
|
|
1952
1992
|
|
1953
1993
|
xhr.open('POST', path, true);
|
1954
1994
|
xhr.setRequestHeader('Content-Type', 'application/json');
|
1995
|
+
xhr.setRequestHeader('Pragma', 'no-cache');
|
1955
1996
|
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
|
1956
1997
|
|
1957
1998
|
var headers = this.headers;
|
@@ -2002,8 +2043,8 @@ Faye.Transport.XHR = Faye.extend(Faye.Class(Faye.Transport, {
|
|
2002
2043
|
xhr.send(Faye.toJSON(message));
|
2003
2044
|
}
|
2004
2045
|
}), {
|
2005
|
-
isUsable: function(endpoint, callback, context) {
|
2006
|
-
callback.call(context, Faye.URI.parse(endpoint).
|
2046
|
+
isUsable: function(client, endpoint, callback, context) {
|
2047
|
+
callback.call(context, Faye.URI.parse(endpoint).isSameOrigin());
|
2007
2048
|
}
|
2008
2049
|
});
|
2009
2050
|
|
@@ -2016,7 +2057,8 @@ Faye.Transport.CORS = Faye.extend(Faye.Class(Faye.Transport, {
|
|
2016
2057
|
retry = this.retry(message, timeout),
|
2017
2058
|
self = this;
|
2018
2059
|
|
2019
|
-
xhr.open('POST', this.
|
2060
|
+
xhr.open('POST', this.endpoint, true);
|
2061
|
+
if (xhr.setRequestHeader) xhr.setRequestHeader('Pragma', 'no-cache');
|
2020
2062
|
|
2021
2063
|
var cleanUp = function() {
|
2022
2064
|
if (!xhr) return false;
|
@@ -2056,8 +2098,8 @@ Faye.Transport.CORS = Faye.extend(Faye.Class(Faye.Transport, {
|
|
2056
2098
|
xhr.send('message=' + encodeURIComponent(Faye.toJSON(message)));
|
2057
2099
|
}
|
2058
2100
|
}), {
|
2059
|
-
isUsable: function(endpoint, callback, context) {
|
2060
|
-
if (Faye.URI.parse(endpoint).
|
2101
|
+
isUsable: function(client, endpoint, callback, context) {
|
2102
|
+
if (Faye.URI.parse(endpoint).isSameOrigin())
|
2061
2103
|
return callback.call(context, false);
|
2062
2104
|
|
2063
2105
|
if (Faye.ENV.XDomainRequest)
|
@@ -2076,13 +2118,22 @@ Faye.Transport.register('cross-origin-long-polling', Faye.Transport.CORS);
|
|
2076
2118
|
|
2077
2119
|
|
2078
2120
|
Faye.Transport.JSONP = Faye.extend(Faye.Class(Faye.Transport, {
|
2079
|
-
|
2080
|
-
var params
|
2121
|
+
shouldFlush: function(messages) {
|
2122
|
+
var params = {
|
2123
|
+
message: Faye.toJSON(messages),
|
2124
|
+
jsonp: '__jsonp' + Faye.Transport.JSONP._cbCount + '__'
|
2125
|
+
};
|
2126
|
+
var location = Faye.URI.parse(this.endpoint, params).toURL();
|
2127
|
+
return location.length >= Faye.Transport.MAX_URL_LENGTH;
|
2128
|
+
},
|
2129
|
+
|
2130
|
+
request: function(messages, timeout) {
|
2131
|
+
var params = {message: Faye.toJSON(messages)},
|
2081
2132
|
head = document.getElementsByTagName('head')[0],
|
2082
2133
|
script = document.createElement('script'),
|
2083
2134
|
callbackName = Faye.Transport.JSONP.getCallbackName(),
|
2084
|
-
location = Faye.URI.parse(this.
|
2085
|
-
retry = this.retry(
|
2135
|
+
location = Faye.URI.parse(this.endpoint, params),
|
2136
|
+
retry = this.retry(messages, timeout),
|
2086
2137
|
self = this;
|
2087
2138
|
|
2088
2139
|
Faye.ENV[callbackName] = function(data) {
|
@@ -2119,7 +2170,7 @@ Faye.Transport.JSONP = Faye.extend(Faye.Class(Faye.Transport, {
|
|
2119
2170
|
return '__jsonp' + this._cbCount + '__';
|
2120
2171
|
},
|
2121
2172
|
|
2122
|
-
isUsable: function(endpoint, callback, context) {
|
2173
|
+
isUsable: function(client, endpoint, callback, context) {
|
2123
2174
|
callback.call(context, true);
|
2124
2175
|
}
|
2125
2176
|
});
|
data/lib/faye.rb
CHANGED
@@ -8,7 +8,7 @@ JS.ENV.FayeSpec = JS.Test.describe("Faye", function() { with(this) {
|
|
8
8
|
|
9
9
|
it("always produces the same length of string", function() { with(this) {
|
10
10
|
var ids = $R(1,100).map(function() { return Faye.random().length })
|
11
|
-
var expected = $R(1,100).map(function() { return
|
11
|
+
var expected = $R(1,100).map(function() { return 35 })
|
12
12
|
assertEqual( expected, ids )
|
13
13
|
}})
|
14
14
|
}})
|
@@ -80,7 +80,7 @@ JS.ENV.NodeAdapterSteps = JS.Test.asyncSteps({
|
|
80
80
|
},
|
81
81
|
|
82
82
|
check_content_type: function(type, resume) {
|
83
|
-
this.assertEqual(type, this._response.headers["content-type"])
|
83
|
+
this.assertEqual(type + "; charset=utf-8", this._response.headers["content-type"])
|
84
84
|
resume()
|
85
85
|
},
|
86
86
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
JS.ENV.TransportSpec = JS.Test.describe("Transport", function() { with(this) {
|
2
2
|
before(function() { with(this) {
|
3
|
-
this.client = {endpoint: "http://example.com/", endpoints: {}}
|
3
|
+
this.client = {endpoint: "http://example.com/", endpoints: {}, transports: {}}
|
4
4
|
|
5
5
|
if (Faye.Transport.NodeLocal) {
|
6
6
|
this.LocalTransport = Faye.Transport.NodeLocal
|
data/spec/ruby/client_spec.rb
CHANGED
@@ -2,7 +2,7 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
describe Faye::Client do
|
4
4
|
let :transport do
|
5
|
-
transport = mock("transport", :cookies= => nil, :headers= => nil)
|
5
|
+
transport = mock("transport", :cookies= => nil, :endpoint => "http://www.example.com/faye", :headers= => nil)
|
6
6
|
transport.stub(:connection_type).and_return "fake"
|
7
7
|
transport.stub(:send)
|
8
8
|
transport.extend(Faye::Publisher)
|
data/spec/ruby/faye_spec.rb
CHANGED
@@ -45,7 +45,7 @@ describe Faye::RackAdapter do
|
|
45
45
|
server.stub(:process).and_yield ["channel" => "/meta/handshake"]
|
46
46
|
post "/bayeux", "message=%5B%5D"
|
47
47
|
status.should == 200
|
48
|
-
content_type.should == "application/json"
|
48
|
+
content_type.should == "application/json; charset=utf-8"
|
49
49
|
content_length.should == "31"
|
50
50
|
json.should == ["channel" => "/meta/handshake"]
|
51
51
|
end
|
@@ -54,14 +54,14 @@ describe Faye::RackAdapter do
|
|
54
54
|
server.should_not_receive(:process)
|
55
55
|
post "/bayeux", "message=%7B%5B"
|
56
56
|
status.should == 400
|
57
|
-
content_type.should == "text/plain"
|
57
|
+
content_type.should == "text/plain; charset=utf-8"
|
58
58
|
end
|
59
59
|
|
60
60
|
it "returns a 404 if the path is not matched" do
|
61
61
|
server.should_not_receive(:process)
|
62
62
|
post "/blaf", 'message=%5B%5D'
|
63
63
|
status.should == 404
|
64
|
-
content_type.should == "text/plain"
|
64
|
+
content_type.should == "text/plain; charset=utf-8"
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
@@ -96,7 +96,7 @@ describe Faye::RackAdapter do
|
|
96
96
|
server.stub(:process).and_yield ["channel" => "/meta/handshake"]
|
97
97
|
post "/bayeux", '[]'
|
98
98
|
status.should == 200
|
99
|
-
content_type.should == "application/json"
|
99
|
+
content_type.should == "application/json; charset=utf-8"
|
100
100
|
content_length.should == "31"
|
101
101
|
json.should == ["channel" => "/meta/handshake"]
|
102
102
|
end
|
@@ -105,14 +105,14 @@ describe Faye::RackAdapter do
|
|
105
105
|
server.should_not_receive(:process)
|
106
106
|
post "/bayeux", "[}"
|
107
107
|
status.should == 400
|
108
|
-
content_type.should == "text/plain"
|
108
|
+
content_type.should == "text/plain; charset=utf-8"
|
109
109
|
end
|
110
110
|
|
111
111
|
it "returns a 404 if the path is not matched" do
|
112
112
|
server.should_not_receive(:process)
|
113
113
|
post "/blaf", "[]"
|
114
114
|
status.should == 404
|
115
|
-
content_type.should == "text/plain"
|
115
|
+
content_type.should == "text/plain; charset=utf-8"
|
116
116
|
end
|
117
117
|
end
|
118
118
|
|
@@ -126,7 +126,7 @@ describe Faye::RackAdapter do
|
|
126
126
|
server.stub(:process).and_yield ["channel" => "/meta/handshake"]
|
127
127
|
post "/bayeux", :message => '[]'
|
128
128
|
status.should == 200
|
129
|
-
content_type.should == "application/json"
|
129
|
+
content_type.should == "application/json; charset=utf-8"
|
130
130
|
content_length.should == "31"
|
131
131
|
json.should == ["channel" => "/meta/handshake"]
|
132
132
|
end
|
@@ -135,14 +135,14 @@ describe Faye::RackAdapter do
|
|
135
135
|
server.should_not_receive(:process)
|
136
136
|
post "/bayeux", :message => "[}"
|
137
137
|
status.should == 400
|
138
|
-
content_type.should == "text/plain"
|
138
|
+
content_type.should == "text/plain; charset=utf-8"
|
139
139
|
end
|
140
140
|
|
141
141
|
it "returns a 404 if the path is not matched" do
|
142
142
|
server.should_not_receive(:process)
|
143
143
|
post "/blaf", :message => "[]"
|
144
144
|
status.should == 404
|
145
|
-
content_type.should == "text/plain"
|
145
|
+
content_type.should == "text/plain; charset=utf-8"
|
146
146
|
end
|
147
147
|
end
|
148
148
|
end
|
@@ -164,7 +164,7 @@ describe Faye::RackAdapter do
|
|
164
164
|
server.stub(:process).and_yield ["channel" => "/meta/handshake"]
|
165
165
|
get "/bayeux", params
|
166
166
|
status.should == 200
|
167
|
-
content_type.should == "text/javascript"
|
167
|
+
content_type.should == "text/javascript; charset=utf-8"
|
168
168
|
content_length.should == "42"
|
169
169
|
body.should == 'callback([{"channel":"/meta/handshake"}]);'
|
170
170
|
end
|
@@ -181,7 +181,7 @@ describe Faye::RackAdapter do
|
|
181
181
|
server.should_not_receive(:process)
|
182
182
|
get "/blah", params
|
183
183
|
status.should == 404
|
184
|
-
content_type.should == "text/plain"
|
184
|
+
content_type.should == "text/plain; charset=utf-8"
|
185
185
|
end
|
186
186
|
end
|
187
187
|
|
@@ -195,7 +195,7 @@ describe Faye::RackAdapter do
|
|
195
195
|
server.stub(:process).and_yield ["channel" => "/meta/handshake"]
|
196
196
|
get "/bayeux", params
|
197
197
|
status.should == 200
|
198
|
-
content_type.should == "text/javascript"
|
198
|
+
content_type.should == "text/javascript; charset=utf-8"
|
199
199
|
content_length.should == "47"
|
200
200
|
body.should == 'jsonpcallback([{"channel":"/meta/handshake"}]);'
|
201
201
|
end
|
@@ -210,7 +210,7 @@ describe Faye::RackAdapter do
|
|
210
210
|
it "returns a 400 response" do
|
211
211
|
get "/bayeux", params
|
212
212
|
status.should == 400
|
213
|
-
content_type.should == "text/plain"
|
213
|
+
content_type.should == "text/plain; charset=utf-8"
|
214
214
|
end
|
215
215
|
end
|
216
216
|
|
@@ -228,7 +228,7 @@ describe Faye::RackAdapter do
|
|
228
228
|
it "returns the client script" do
|
229
229
|
get "/bayeux.js"
|
230
230
|
status.should == 200
|
231
|
-
content_type.should == "text/javascript"
|
231
|
+
content_type.should == "text/javascript; charset=utf-8"
|
232
232
|
body.should =~ /function\(\)\{/
|
233
233
|
end
|
234
234
|
end
|
data/spec/ruby/transport_spec.rb
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
describe Faye::Transport do
|
4
|
+
before do
|
5
|
+
Faye.ensure_reactor_running!
|
6
|
+
end
|
7
|
+
|
4
8
|
let :client do
|
5
|
-
|
6
|
-
client.stub(:endpoint).and_return("http://example.com/")
|
7
|
-
client.stub(:endpoints).and_return({})
|
8
|
-
client
|
9
|
+
mock("client", :endpoint => "http://example.com/", :endpoints => {}, :transports => {})
|
9
10
|
end
|
10
11
|
|
11
12
|
describe :get do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: faye
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-09-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: cookiejar
|