firehose 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -6,3 +6,5 @@
6
6
  Gemfile.lock
7
7
  log/*
8
8
  pkg/*
9
+ *.sublime-project
10
+ *.sublime-workspace
@@ -5,5 +5,3 @@
5
5
  #= require firehose/long_poll
6
6
  #= require firehose/web_socket
7
7
  #= require firehose/consumer
8
- #= require firehose/lib/swfobject
9
- #= require firehose/lib/web_socket
@@ -1,7 +1,3 @@
1
- # Unfortunately this needs to a global variable. The only other option is to
2
- # hack into the internals of the web_socket.js plugin we are using.
3
- window.WEB_SOCKET_SWF_LOCATION = '/assets/firehose/WebSocketMain.swf' if !window.WEB_SOCKET_SWF_LOCATION
4
-
5
1
  INITIAL_PING_TIMEOUT = 2000
6
2
  KEEPALIVE_PING_TIMEOUT = 20000
7
3
 
@@ -16,9 +16,10 @@ module Firehose
16
16
  # with the same error.
17
17
  # The final goal is to allow the failed deferrable bubble back up
18
18
  # so we can send back a nice, clean 500 error to the client.
19
- pubsub.subscribe('firehose:channel_updates').
19
+ channel_updates_key = Server.key('channel_updates')
20
+ pubsub.subscribe(channel_updates_key).
20
21
  errback{|e| EM.next_tick { raise e } }.
21
- callback { Firehose.logger.debug "Redis subscribed to `firehose:channel_updates`" }
22
+ callback { Firehose.logger.debug "Redis subscribed to `#{channel_updates_key}`" }
22
23
  pubsub.on(:message) do |_, payload|
23
24
  channel_key, sequence, message = Server::Publisher.from_payload(payload)
24
25
 
@@ -1,4 +1,4 @@
1
1
  module Firehose
2
- VERSION = "1.2.0"
3
- CODENAME = "Spring Cleaning"
2
+ VERSION = "1.2.1"
3
+ CODENAME = "Spring Cleaning 2 - Electric Boogaloo"
4
4
  end
@@ -17,10 +17,10 @@ shared_examples_for 'Firehose::Rack::App' do
17
17
  end
18
18
 
19
19
  before(:each) { WebMock.disable! }
20
- after(:each) { WebMock.enable! }
20
+ after(:each) { WebMock.enable! }
21
21
 
22
22
  let(:app) { Firehose::Rack::App.new }
23
- let(:messages) { (1..2000).map{|n| "msg-#{n}" } }
23
+ let(:messages) { (1..200).map{|n| "msg-#{n}" } }
24
24
  let(:channel) { "/firehose/integration/#{Time.now.to_i}" }
25
25
  let(:http_url) { "http://#{uri.host}:#{uri.port}#{channel}" }
26
26
  let(:ws_url) { "ws://#{uri.host}:#{uri.port}#{channel}" }
metadata CHANGED
@@ -1,7 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: firehose
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Brad Gessler
@@ -11,11 +12,12 @@ authors:
11
12
  autorequire:
12
13
  bindir: bin
13
14
  cert_chain: []
14
- date: 2013-04-20 00:00:00.000000000 Z
15
+ date: 2013-04-23 00:00:00.000000000 Z
15
16
  dependencies:
16
17
  - !ruby/object:Gem::Dependency
17
18
  name: eventmachine
18
19
  requirement: !ruby/object:Gem::Requirement
20
+ none: false
19
21
  requirements:
20
22
  - - ! '>='
21
23
  - !ruby/object:Gem::Version
@@ -23,6 +25,7 @@ dependencies:
23
25
  type: :runtime
24
26
  prerelease: false
25
27
  version_requirements: !ruby/object:Gem::Requirement
28
+ none: false
26
29
  requirements:
27
30
  - - ! '>='
28
31
  - !ruby/object:Gem::Version
@@ -30,6 +33,7 @@ dependencies:
30
33
  - !ruby/object:Gem::Dependency
31
34
  name: em-hiredis
32
35
  requirement: !ruby/object:Gem::Requirement
36
+ none: false
33
37
  requirements:
34
38
  - - ! '>='
35
39
  - !ruby/object:Gem::Version
@@ -37,6 +41,7 @@ dependencies:
37
41
  type: :runtime
38
42
  prerelease: false
39
43
  version_requirements: !ruby/object:Gem::Requirement
44
+ none: false
40
45
  requirements:
41
46
  - - ! '>='
42
47
  - !ruby/object:Gem::Version
@@ -44,6 +49,7 @@ dependencies:
44
49
  - !ruby/object:Gem::Dependency
45
50
  name: thor
46
51
  requirement: !ruby/object:Gem::Requirement
52
+ none: false
47
53
  requirements:
48
54
  - - ! '>='
49
55
  - !ruby/object:Gem::Version
@@ -51,6 +57,7 @@ dependencies:
51
57
  type: :runtime
52
58
  prerelease: false
53
59
  version_requirements: !ruby/object:Gem::Requirement
60
+ none: false
54
61
  requirements:
55
62
  - - ! '>='
56
63
  - !ruby/object:Gem::Version
@@ -58,6 +65,7 @@ dependencies:
58
65
  - !ruby/object:Gem::Dependency
59
66
  name: faraday
60
67
  requirement: !ruby/object:Gem::Requirement
68
+ none: false
61
69
  requirements:
62
70
  - - ! '>='
63
71
  - !ruby/object:Gem::Version
@@ -65,6 +73,7 @@ dependencies:
65
73
  type: :runtime
66
74
  prerelease: false
67
75
  version_requirements: !ruby/object:Gem::Requirement
76
+ none: false
68
77
  requirements:
69
78
  - - ! '>='
70
79
  - !ruby/object:Gem::Version
@@ -72,6 +81,7 @@ dependencies:
72
81
  - !ruby/object:Gem::Dependency
73
82
  name: faye-websocket
74
83
  requirement: !ruby/object:Gem::Requirement
84
+ none: false
75
85
  requirements:
76
86
  - - ! '>='
77
87
  - !ruby/object:Gem::Version
@@ -79,6 +89,7 @@ dependencies:
79
89
  type: :runtime
80
90
  prerelease: false
81
91
  version_requirements: !ruby/object:Gem::Requirement
92
+ none: false
82
93
  requirements:
83
94
  - - ! '>='
84
95
  - !ruby/object:Gem::Version
@@ -86,6 +97,7 @@ dependencies:
86
97
  - !ruby/object:Gem::Dependency
87
98
  name: em-http-request
88
99
  requirement: !ruby/object:Gem::Requirement
100
+ none: false
89
101
  requirements:
90
102
  - - ! '>='
91
103
  - !ruby/object:Gem::Version
@@ -93,6 +105,7 @@ dependencies:
93
105
  type: :runtime
94
106
  prerelease: false
95
107
  version_requirements: !ruby/object:Gem::Requirement
108
+ none: false
96
109
  requirements:
97
110
  - - ! '>='
98
111
  - !ruby/object:Gem::Version
@@ -100,6 +113,7 @@ dependencies:
100
113
  - !ruby/object:Gem::Dependency
101
114
  name: json
102
115
  requirement: !ruby/object:Gem::Requirement
116
+ none: false
103
117
  requirements:
104
118
  - - ! '>='
105
119
  - !ruby/object:Gem::Version
@@ -107,6 +121,7 @@ dependencies:
107
121
  type: :runtime
108
122
  prerelease: false
109
123
  version_requirements: !ruby/object:Gem::Requirement
124
+ none: false
110
125
  requirements:
111
126
  - - ! '>='
112
127
  - !ruby/object:Gem::Version
@@ -114,6 +129,7 @@ dependencies:
114
129
  - !ruby/object:Gem::Dependency
115
130
  name: rspec
116
131
  requirement: !ruby/object:Gem::Requirement
132
+ none: false
117
133
  requirements:
118
134
  - - ! '>='
119
135
  - !ruby/object:Gem::Version
@@ -121,6 +137,7 @@ dependencies:
121
137
  type: :development
122
138
  prerelease: false
123
139
  version_requirements: !ruby/object:Gem::Requirement
140
+ none: false
124
141
  requirements:
125
142
  - - ! '>='
126
143
  - !ruby/object:Gem::Version
@@ -128,6 +145,7 @@ dependencies:
128
145
  - !ruby/object:Gem::Dependency
129
146
  name: webmock
130
147
  requirement: !ruby/object:Gem::Requirement
148
+ none: false
131
149
  requirements:
132
150
  - - ! '>='
133
151
  - !ruby/object:Gem::Version
@@ -135,6 +153,7 @@ dependencies:
135
153
  type: :development
136
154
  prerelease: false
137
155
  version_requirements: !ruby/object:Gem::Requirement
156
+ none: false
138
157
  requirements:
139
158
  - - ! '>='
140
159
  - !ruby/object:Gem::Version
@@ -142,6 +161,7 @@ dependencies:
142
161
  - !ruby/object:Gem::Dependency
143
162
  name: guard-rspec
144
163
  requirement: !ruby/object:Gem::Requirement
164
+ none: false
145
165
  requirements:
146
166
  - - ! '>='
147
167
  - !ruby/object:Gem::Version
@@ -149,6 +169,7 @@ dependencies:
149
169
  type: :development
150
170
  prerelease: false
151
171
  version_requirements: !ruby/object:Gem::Requirement
172
+ none: false
152
173
  requirements:
153
174
  - - ! '>='
154
175
  - !ruby/object:Gem::Version
@@ -156,6 +177,7 @@ dependencies:
156
177
  - !ruby/object:Gem::Dependency
157
178
  name: guard-bundler
158
179
  requirement: !ruby/object:Gem::Requirement
180
+ none: false
159
181
  requirements:
160
182
  - - ! '>='
161
183
  - !ruby/object:Gem::Version
@@ -163,6 +185,7 @@ dependencies:
163
185
  type: :development
164
186
  prerelease: false
165
187
  version_requirements: !ruby/object:Gem::Requirement
188
+ none: false
166
189
  requirements:
167
190
  - - ! '>='
168
191
  - !ruby/object:Gem::Version
@@ -170,6 +193,7 @@ dependencies:
170
193
  - !ruby/object:Gem::Dependency
171
194
  name: guard-coffeescript
172
195
  requirement: !ruby/object:Gem::Requirement
196
+ none: false
173
197
  requirements:
174
198
  - - ! '>='
175
199
  - !ruby/object:Gem::Version
@@ -177,6 +201,7 @@ dependencies:
177
201
  type: :development
178
202
  prerelease: false
179
203
  version_requirements: !ruby/object:Gem::Requirement
204
+ none: false
180
205
  requirements:
181
206
  - - ! '>='
182
207
  - !ruby/object:Gem::Version
@@ -184,6 +209,7 @@ dependencies:
184
209
  - !ruby/object:Gem::Dependency
185
210
  name: rainbows
186
211
  requirement: !ruby/object:Gem::Requirement
212
+ none: false
187
213
  requirements:
188
214
  - - ~>
189
215
  - !ruby/object:Gem::Version
@@ -191,6 +217,7 @@ dependencies:
191
217
  type: :development
192
218
  prerelease: false
193
219
  version_requirements: !ruby/object:Gem::Requirement
220
+ none: false
194
221
  requirements:
195
222
  - - ~>
196
223
  - !ruby/object:Gem::Version
@@ -198,6 +225,7 @@ dependencies:
198
225
  - !ruby/object:Gem::Dependency
199
226
  name: thin
200
227
  requirement: !ruby/object:Gem::Requirement
228
+ none: false
201
229
  requirements:
202
230
  - - ! '>='
203
231
  - !ruby/object:Gem::Version
@@ -205,6 +233,7 @@ dependencies:
205
233
  type: :development
206
234
  prerelease: false
207
235
  version_requirements: !ruby/object:Gem::Requirement
236
+ none: false
208
237
  requirements:
209
238
  - - ! '>='
210
239
  - !ruby/object:Gem::Version
@@ -212,6 +241,7 @@ dependencies:
212
241
  - !ruby/object:Gem::Dependency
213
242
  name: rack-test
214
243
  requirement: !ruby/object:Gem::Requirement
244
+ none: false
215
245
  requirements:
216
246
  - - ! '>='
217
247
  - !ruby/object:Gem::Version
@@ -219,6 +249,7 @@ dependencies:
219
249
  type: :development
220
250
  prerelease: false
221
251
  version_requirements: !ruby/object:Gem::Requirement
252
+ none: false
222
253
  requirements:
223
254
  - - ! '>='
224
255
  - !ruby/object:Gem::Version
@@ -226,6 +257,7 @@ dependencies:
226
257
  - !ruby/object:Gem::Dependency
227
258
  name: async_rack_test
228
259
  requirement: !ruby/object:Gem::Requirement
260
+ none: false
229
261
  requirements:
230
262
  - - ! '>='
231
263
  - !ruby/object:Gem::Version
@@ -233,6 +265,7 @@ dependencies:
233
265
  type: :development
234
266
  prerelease: false
235
267
  version_requirements: !ruby/object:Gem::Requirement
268
+ none: false
236
269
  requirements:
237
270
  - - ! '>='
238
271
  - !ruby/object:Gem::Version
@@ -240,6 +273,7 @@ dependencies:
240
273
  - !ruby/object:Gem::Dependency
241
274
  name: foreman
242
275
  requirement: !ruby/object:Gem::Requirement
276
+ none: false
243
277
  requirements:
244
278
  - - ! '>='
245
279
  - !ruby/object:Gem::Version
@@ -247,6 +281,7 @@ dependencies:
247
281
  type: :development
248
282
  prerelease: false
249
283
  version_requirements: !ruby/object:Gem::Requirement
284
+ none: false
250
285
  requirements:
251
286
  - - ! '>='
252
287
  - !ruby/object:Gem::Version
@@ -254,6 +289,7 @@ dependencies:
254
289
  - !ruby/object:Gem::Dependency
255
290
  name: sprockets
256
291
  requirement: !ruby/object:Gem::Requirement
292
+ none: false
257
293
  requirements:
258
294
  - - ! '>='
259
295
  - !ruby/object:Gem::Version
@@ -261,6 +297,7 @@ dependencies:
261
297
  type: :development
262
298
  prerelease: false
263
299
  version_requirements: !ruby/object:Gem::Requirement
300
+ none: false
264
301
  requirements:
265
302
  - - ! '>='
266
303
  - !ruby/object:Gem::Version
@@ -268,6 +305,7 @@ dependencies:
268
305
  - !ruby/object:Gem::Dependency
269
306
  name: rake
270
307
  requirement: !ruby/object:Gem::Requirement
308
+ none: false
271
309
  requirements:
272
310
  - - ! '>='
273
311
  - !ruby/object:Gem::Version
@@ -275,6 +313,7 @@ dependencies:
275
313
  type: :development
276
314
  prerelease: false
277
315
  version_requirements: !ruby/object:Gem::Requirement
316
+ none: false
278
317
  requirements:
279
318
  - - ! '>='
280
319
  - !ruby/object:Gem::Version
@@ -304,14 +343,10 @@ files:
304
343
  - bin/firehose
305
344
  - config/rainbows.rb
306
345
  - firehose.gemspec
307
- - lib/assets/flash/firehose/WebSocketMain.swf
308
- - lib/assets/flash/firehose/WebSocketMainInsecure.swf
309
346
  - lib/assets/javascripts/firehose.js.coffee
310
347
  - lib/assets/javascripts/firehose/base.js.coffee
311
348
  - lib/assets/javascripts/firehose/consumer.js.coffee
312
349
  - lib/assets/javascripts/firehose/json2.js
313
- - lib/assets/javascripts/firehose/lib/swfobject.js
314
- - lib/assets/javascripts/firehose/lib/web_socket.js
315
350
  - lib/assets/javascripts/firehose/long_poll.js.coffee
316
351
  - lib/assets/javascripts/firehose/transport.js.coffee
317
352
  - lib/assets/javascripts/firehose/version.js.coffee.erb
@@ -356,26 +391,27 @@ files:
356
391
  - spec/spec_helper.rb
357
392
  homepage: http://firehose.io/
358
393
  licenses: []
359
- metadata: {}
360
394
  post_install_message:
361
395
  rdoc_options: []
362
396
  require_paths:
363
397
  - lib
364
398
  required_ruby_version: !ruby/object:Gem::Requirement
399
+ none: false
365
400
  requirements:
366
401
  - - ! '>='
367
402
  - !ruby/object:Gem::Version
368
403
  version: '0'
369
404
  required_rubygems_version: !ruby/object:Gem::Requirement
405
+ none: false
370
406
  requirements:
371
407
  - - ! '>='
372
408
  - !ruby/object:Gem::Version
373
409
  version: '0'
374
410
  requirements: []
375
411
  rubyforge_project: firehose
376
- rubygems_version: 2.0.3
412
+ rubygems_version: 1.8.23
377
413
  signing_key:
378
- specification_version: 4
414
+ specification_version: 3
379
415
  summary: Build realtime Ruby web applications
380
416
  test_files:
381
417
  - spec/integrations/integration_test_helper.rb
@@ -394,4 +430,3 @@ test_files:
394
430
  - spec/lib/server/publisher_spec.rb
395
431
  - spec/lib/server/subscriber_spec.rb
396
432
  - spec/spec_helper.rb
397
- has_rdoc:
checksums.yaml DELETED
@@ -1,15 +0,0 @@
1
- ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- Yzc5MDg5MDIyZWJmYjY1ZTZjM2FiYTMzNDIxNjczYmYwZWUzNTI2Yg==
5
- data.tar.gz: !binary |-
6
- YjU0ODhhNDk3MWMwZTg2NTJkMDE3Y2M1MGE2YjY1OWQzN2ZkNjdkYg==
7
- !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- YTAwMDFmZDY3OWUxMjRhNDQ3ZDJkZmQzMmQyODZkZGFiZmUwMzQ0NWRkYjdm
10
- OWFmMzVmOThmY2VmY2ZjNjJmMzViNzRiN2MyMjIzMDM0N2U0OGU0MDc0N2Iz
11
- YjIwMDMyYWM3OTgzZDJmY2E1MDZmODZmY2QyYTVmYzEyYTExZmU=
12
- data.tar.gz: !binary |-
13
- M2ZlMTNiNGZjZTk1NDMyZDM4Y2EyY2M5MWFjYmEwY2E3YWQ1YmM2NTQ2OTU4
14
- ZjEwNjgwZmQ1NjQyNDBmM2YyMWQwYzMxM2Y1MDc1NWQ1YzczM2M5ZTVmYWU3
15
- YTk4ZjVmYTFhYTA3MDIwOGYzZjBkNjc3NDNmOWQ5OTA5NWFjNWM=
@@ -1,4 +0,0 @@
1
- /* SWFObject v2.2 <http://code.google.com/p/swfobject/>
2
- is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
3
- */
4
- var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y<X;Y++){U[Y]()}}function K(X){if(J){X()}else{U[U.length]=X}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener("load",Y,false)}else{if(typeof j.addEventListener!=D){j.addEventListener("load",Y,false)}else{if(typeof O.attachEvent!=D){i(O,"onload",Y)}else{if(typeof O.onload=="function"){var X=O.onload;O.onload=function(){X();Y()}}else{O.onload=Y}}}}}function h(){if(T){V()}else{H()}}function V(){var X=j.getElementsByTagName("body")[0];var aa=C(r);aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;(function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");if(ab){ab=ab.split(" ")[1].split(",");M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}else{if(Y<10){Y++;setTimeout(arguments.callee,10);return}}X.removeChild(aa);Z=null;H()})()}else{H()}}function H(){var ag=o.length;if(ag>0){for(var af=0;af<ag;af++){var Y=o[af].id;var ab=o[af].callbackFn;var aa={success:false,id:Y};if(M.pv[0]>0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad<ac;ad++){if(X[ad].getAttribute("name").toLowerCase()!="movie"){ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value")}}P(ai,ah,Y,ab)}else{p(ae);if(ab){ab(aa)}}}}}else{w(Y,true);if(ab){var Z=z(Y);if(Z&&typeof Z.SetVariable!=D){aa.success=true;aa.ref=Z}ab(aa)}}}}}function z(aa){var X=null;var Y=c(aa);if(Y&&Y.nodeName=="OBJECT"){if(typeof Y.SetVariable!=D){X=Y}else{var Z=Y.getElementsByTagName(r)[0];if(Z){X=Z}}}return X}function A(){return !a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)}function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};var ae=c(X);if(ae){if(ae.nodeName=="OBJECT"){l=g(ae);Q=null}else{l=ae;Q=X}aa.id=R;if(typeof aa.width==D||(!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)){aa.width="310"}if(typeof aa.height==D||(!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)){aa.height="137"}j.title=j.title.slice(0,47)+" - Flash Player Installation";var ad=M.ie&&M.win?"ActiveX":"PlugIn",ac="MMredirectURL="+O.location.toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D){ab.flashvars+="&"+ac}else{ab.flashvars=ac}if(M.ie&&M.win&&ae.readyState!=4){var Y=C("div");X+="SWFObjectNew";Y.setAttribute("id",X);ae.parentNode.insertBefore(Y,ae);ae.style.display="none";(function(){if(ae.readyState==4){ae.parentNode.removeChild(ae)}else{setTimeout(arguments.callee,10)}})()}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&Y.readyState!=4){var X=C("div");Y.parentNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);Y.style.display="none";(function(){if(Y.readyState==4){Y.parentNode.removeChild(Y)}else{setTimeout(arguments.callee,10)}})()}else{Y.parentNode.replaceChild(g(Y),Y)}}function g(ab){var aa=C("div");if(M.win&&M.ie){aa.innerHTML=ab.innerHTML}else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;for(var Z=0;Z<X;Z++){if(!(ad[Z].nodeType==1&&ad[Z].nodeName=="PARAM")&&!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true))}}}}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312){return X}if(aa){if(typeof ai.id==D){ai.id=Y}if(M.ie&&M.win){var ah="";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="data"){ag.movie=ai[ae]}else{if(ae.toLowerCase()=="styleclass"){ah+=' class="'+ai[ae]+'"'}else{if(ae.toLowerCase()!="classid"){ah+=" "+ae+'="'+ai[ae]+'"'}}}}}var af="";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+='<param name="'+ad+'" value="'+ag[ad]+'" />'}}aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab<ac;ab++){I[ab][0].detachEvent(I[ab][1],I[ab][2])}var Z=N.length;for(var aa=0;aa<Z;aa++){y(N[aa])}for(var Y in M){M[Y]=null}M=null;for(var X in swfobject){swfobject[X]=null}swfobject=null})}}();return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};Y.id=ab;Y.swfVersion=X;Y.expressInstall=aa;Y.callbackFn=Z;o[o.length]=Y;w(ab,false)}else{if(Z){Z({success:false,id:ab})}}},getObjectById:function(X){if(M.w3){return z(X)}},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:false,id:ah};if(M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y){w(ah,false);K(function(){ae+="";ag+="";var aj={};if(af&&typeof af===r){for(var al in af){aj[al]=af[al]}}aj.data=ab;aj.width=ae;aj.height=ag;var am={};if(ad&&typeof ad===r){for(var ak in ad){am[ak]=ad[ak]}}if(Z&&typeof Z===r){for(var ai in Z){if(typeof am.flashvars!=D){am.flashvars+="&"+ai+"="+Z[ai]}else{am.flashvars=ai+"="+Z[ai]}}}if(F(Y)){var an=u(aj,am,ah);if(aj.id==ah){w(ah,true)}X.success=true;X.ref=an}else{if(aa&&A()){aj.data=aa;P(aj,am,ah,ac);return}else{w(ah,true)}}if(ac){ac(X)}})}else{if(ac){ac(X)}}},switchOffAutoHideShow:function(){m=false},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){if(M.w3){return u(Z,Y,X)}else{return undefined}},showExpressInstall:function(Z,aa,X,Y){if(M.w3&&A()){P(Z,aa,X,Y)}},removeSWF:function(X){if(M.w3){y(X)}},createCSS:function(aa,Z,Y,X){if(M.w3){v(aa,Z,Y,X)}},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;if(Z){if(/\?/.test(Z)){Z=Z.split("?")[1]}if(aa==null){return L(Z)}var Y=Z.split("&");for(var X=0;X<Y.length;X++){if(Y[X].substring(0,Y[X].indexOf("="))==aa){return L(Y[X].substring((Y[X].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(a){var X=c(R);if(X&&l){X.parentNode.replaceChild(l,X);if(Q){w(Q,true);if(M.ie&&M.win){l.style.display="block"}}if(E){E(B)}}a=false}}}}();
@@ -1,389 +0,0 @@
1
- // Copyright: Hiroshi Ichikawa <http://gimite.net/en/>
2
- // License: New BSD License
3
- // Reference: http://dev.w3.org/html5/websockets/
4
- // Reference: http://tools.ietf.org/html/rfc6455
5
-
6
- (function() {
7
-
8
- if (window.WEB_SOCKET_FORCE_FLASH) {
9
- // Keeps going.
10
- } else if (window.WebSocket) {
11
- return;
12
- } else if (window.MozWebSocket) {
13
- // Firefox.
14
- window.WebSocket = MozWebSocket;
15
- return;
16
- }
17
-
18
- var logger;
19
- if (window.WEB_SOCKET_LOGGER) {
20
- logger = WEB_SOCKET_LOGGER;
21
- } else if (window.console && window.console.log && window.console.error) {
22
- // In some environment, console is defined but console.log or console.error is missing.
23
- logger = window.console;
24
- } else {
25
- logger = {log: function(){ }, error: function(){ }};
26
- }
27
-
28
- // swfobject.hasFlashPlayerVersion("10.0.0") doesn't work with Gnash.
29
- if (swfobject.getFlashPlayerVersion().major < 10) {
30
- logger.error("Flash Player >= 10.0.0 is required.");
31
- return;
32
- }
33
- if (location.protocol == "file:") {
34
- logger.error(
35
- "WARNING: web-socket-js doesn't work in file:///... URL " +
36
- "unless you set Flash Security Settings properly. " +
37
- "Open the page via Web server i.e. http://...");
38
- }
39
-
40
- /**
41
- * Our own implementation of WebSocket class using Flash.
42
- * @param {string} url
43
- * @param {array or string} protocols
44
- * @param {string} proxyHost
45
- * @param {int} proxyPort
46
- * @param {string} headers
47
- */
48
- window.WebSocket = function(url, protocols, proxyHost, proxyPort, headers) {
49
- var self = this;
50
- self.__id = WebSocket.__nextId++;
51
- WebSocket.__instances[self.__id] = self;
52
- self.readyState = WebSocket.CONNECTING;
53
- self.bufferedAmount = 0;
54
- self.__events = {};
55
- if (!protocols) {
56
- protocols = [];
57
- } else if (typeof protocols == "string") {
58
- protocols = [protocols];
59
- }
60
- // Uses setTimeout() to make sure __createFlash() runs after the caller sets ws.onopen etc.
61
- // Otherwise, when onopen fires immediately, onopen is called before it is set.
62
- self.__createTask = setTimeout(function() {
63
- WebSocket.__addTask(function() {
64
- self.__createTask = null;
65
- WebSocket.__flash.create(
66
- self.__id, url, protocols, proxyHost || null, proxyPort || 0, headers || null);
67
- });
68
- }, 0);
69
- };
70
-
71
- /**
72
- * Send data to the web socket.
73
- * @param {string} data The data to send to the socket.
74
- * @return {boolean} True for success, false for failure.
75
- */
76
- WebSocket.prototype.send = function(data) {
77
- if (this.readyState == WebSocket.CONNECTING) {
78
- throw "INVALID_STATE_ERR: Web Socket connection has not been established";
79
- }
80
- // We use encodeURIComponent() here, because FABridge doesn't work if
81
- // the argument includes some characters. We don't use escape() here
82
- // because of this:
83
- // https://developer.mozilla.org/en/Core_JavaScript_1.5_Guide/Functions#escape_and_unescape_Functions
84
- // But it looks decodeURIComponent(encodeURIComponent(s)) doesn't
85
- // preserve all Unicode characters either e.g. "\uffff" in Firefox.
86
- // Note by wtritch: Hopefully this will not be necessary using ExternalInterface. Will require
87
- // additional testing.
88
- var result = WebSocket.__flash.send(this.__id, encodeURIComponent(data));
89
- if (result < 0) { // success
90
- return true;
91
- } else {
92
- this.bufferedAmount += result;
93
- return false;
94
- }
95
- };
96
-
97
- /**
98
- * Close this web socket gracefully.
99
- */
100
- WebSocket.prototype.close = function() {
101
- if (this.__createTask) {
102
- clearTimeout(this.__createTask);
103
- this.__createTask = null;
104
- this.readyState = WebSocket.CLOSED;
105
- return;
106
- }
107
- if (this.readyState == WebSocket.CLOSED || this.readyState == WebSocket.CLOSING) {
108
- return;
109
- }
110
- this.readyState = WebSocket.CLOSING;
111
- WebSocket.__flash.close(this.__id);
112
- };
113
-
114
- /**
115
- * Implementation of {@link <a href="http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-registration">DOM 2 EventTarget Interface</a>}
116
- *
117
- * @param {string} type
118
- * @param {function} listener
119
- * @param {boolean} useCapture
120
- * @return void
121
- */
122
- WebSocket.prototype.addEventListener = function(type, listener, useCapture) {
123
- if (!(type in this.__events)) {
124
- this.__events[type] = [];
125
- }
126
- this.__events[type].push(listener);
127
- };
128
-
129
- /**
130
- * Implementation of {@link <a href="http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-registration">DOM 2 EventTarget Interface</a>}
131
- *
132
- * @param {string} type
133
- * @param {function} listener
134
- * @param {boolean} useCapture
135
- * @return void
136
- */
137
- WebSocket.prototype.removeEventListener = function(type, listener, useCapture) {
138
- if (!(type in this.__events)) return;
139
- var events = this.__events[type];
140
- for (var i = events.length - 1; i >= 0; --i) {
141
- if (events[i] === listener) {
142
- events.splice(i, 1);
143
- break;
144
- }
145
- }
146
- };
147
-
148
- /**
149
- * Implementation of {@link <a href="http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-registration">DOM 2 EventTarget Interface</a>}
150
- *
151
- * @param {Event} event
152
- * @return void
153
- */
154
- WebSocket.prototype.dispatchEvent = function(event) {
155
- var events = this.__events[event.type] || [];
156
- for (var i = 0; i < events.length; ++i) {
157
- events[i](event);
158
- }
159
- var handler = this["on" + event.type];
160
- if (handler) handler.apply(this, [event]);
161
- };
162
-
163
- /**
164
- * Handles an event from Flash.
165
- * @param {Object} flashEvent
166
- */
167
- WebSocket.prototype.__handleEvent = function(flashEvent) {
168
-
169
- if ("readyState" in flashEvent) {
170
- this.readyState = flashEvent.readyState;
171
- }
172
- if ("protocol" in flashEvent) {
173
- this.protocol = flashEvent.protocol;
174
- }
175
-
176
- var jsEvent;
177
- if (flashEvent.type == "open" || flashEvent.type == "error") {
178
- jsEvent = this.__createSimpleEvent(flashEvent.type);
179
- } else if (flashEvent.type == "close") {
180
- jsEvent = this.__createSimpleEvent("close");
181
- jsEvent.wasClean = flashEvent.wasClean ? true : false;
182
- jsEvent.code = flashEvent.code;
183
- jsEvent.reason = flashEvent.reason;
184
- } else if (flashEvent.type == "message") {
185
- var data = decodeURIComponent(flashEvent.message);
186
- jsEvent = this.__createMessageEvent("message", data);
187
- } else {
188
- throw "unknown event type: " + flashEvent.type;
189
- }
190
-
191
- this.dispatchEvent(jsEvent);
192
-
193
- };
194
-
195
- WebSocket.prototype.__createSimpleEvent = function(type) {
196
- if (document.createEvent && window.Event) {
197
- var event = document.createEvent("Event");
198
- event.initEvent(type, false, false);
199
- return event;
200
- } else {
201
- return {type: type, bubbles: false, cancelable: false};
202
- }
203
- };
204
-
205
- WebSocket.prototype.__createMessageEvent = function(type, data) {
206
- if (document.createEvent && window.MessageEvent && !window.opera) {
207
- var event = document.createEvent("MessageEvent");
208
- event.initMessageEvent("message", false, false, data, null, null, window, null);
209
- return event;
210
- } else {
211
- // IE and Opera, the latter one truncates the data parameter after any 0x00 bytes.
212
- return {type: type, data: data, bubbles: false, cancelable: false};
213
- }
214
- };
215
-
216
- /**
217
- * Define the WebSocket readyState enumeration.
218
- */
219
- WebSocket.CONNECTING = 0;
220
- WebSocket.OPEN = 1;
221
- WebSocket.CLOSING = 2;
222
- WebSocket.CLOSED = 3;
223
-
224
- WebSocket.__initialized = false;
225
- WebSocket.__flash = null;
226
- WebSocket.__instances = {};
227
- WebSocket.__tasks = [];
228
- WebSocket.__nextId = 0;
229
-
230
- /**
231
- * Load a new flash security policy file.
232
- * @param {string} url
233
- */
234
- WebSocket.loadFlashPolicyFile = function(url){
235
- WebSocket.__addTask(function() {
236
- WebSocket.__flash.loadManualPolicyFile(url);
237
- });
238
- };
239
-
240
- /**
241
- * Loads WebSocketMain.swf and creates WebSocketMain object in Flash.
242
- */
243
- WebSocket.__initialize = function() {
244
-
245
- if (WebSocket.__initialized) return;
246
- WebSocket.__initialized = true;
247
-
248
- if (WebSocket.__swfLocation) {
249
- // For backword compatibility.
250
- window.WEB_SOCKET_SWF_LOCATION = WebSocket.__swfLocation;
251
- }
252
- if (!window.WEB_SOCKET_SWF_LOCATION) {
253
- logger.error("[WebSocket] set WEB_SOCKET_SWF_LOCATION to location of WebSocketMain.swf");
254
- return;
255
- }
256
- if (!window.WEB_SOCKET_SUPPRESS_CROSS_DOMAIN_SWF_ERROR &&
257
- !WEB_SOCKET_SWF_LOCATION.match(/(^|\/)WebSocketMainInsecure\.swf(\?.*)?$/) &&
258
- WEB_SOCKET_SWF_LOCATION.match(/^\w+:\/\/([^\/]+)/)) {
259
- var swfHost = RegExp.$1;
260
- if (location.host != swfHost) {
261
- logger.error(
262
- "[WebSocket] You must host HTML and WebSocketMain.swf in the same host " +
263
- "('" + location.host + "' != '" + swfHost + "'). " +
264
- "See also 'How to host HTML file and SWF file in different domains' section " +
265
- "in README.md. If you use WebSocketMainInsecure.swf, you can suppress this message " +
266
- "by WEB_SOCKET_SUPPRESS_CROSS_DOMAIN_SWF_ERROR = true;");
267
- }
268
- }
269
- var container = document.createElement("div");
270
- container.id = "webSocketContainer";
271
- // Hides Flash box. We cannot use display: none or visibility: hidden because it prevents
272
- // Flash from loading at least in IE. So we move it out of the screen at (-100, -100).
273
- // But this even doesn't work with Flash Lite (e.g. in Droid Incredible). So with Flash
274
- // Lite, we put it at (0, 0). This shows 1x1 box visible at left-top corner but this is
275
- // the best we can do as far as we know now.
276
- container.style.position = "absolute";
277
- if (WebSocket.__isFlashLite()) {
278
- container.style.left = "0px";
279
- container.style.top = "0px";
280
- } else {
281
- container.style.left = "-100px";
282
- container.style.top = "-100px";
283
- }
284
- var holder = document.createElement("div");
285
- holder.id = "webSocketFlash";
286
- container.appendChild(holder);
287
- document.body.appendChild(container);
288
- // See this article for hasPriority:
289
- // http://help.adobe.com/en_US/as3/mobile/WS4bebcd66a74275c36cfb8137124318eebc6-7ffd.html
290
- swfobject.embedSWF(
291
- WEB_SOCKET_SWF_LOCATION,
292
- "webSocketFlash",
293
- "1" /* width */,
294
- "1" /* height */,
295
- "10.0.0" /* SWF version */,
296
- null,
297
- null,
298
- {hasPriority: true, swliveconnect : true, allowScriptAccess: "always"},
299
- null,
300
- function(e) {
301
- if (!e.success) {
302
- logger.error("[WebSocket] swfobject.embedSWF failed");
303
- }
304
- }
305
- );
306
-
307
- };
308
-
309
- /**
310
- * Called by Flash to notify JS that it's fully loaded and ready
311
- * for communication.
312
- */
313
- WebSocket.__onFlashInitialized = function() {
314
- // We need to set a timeout here to avoid round-trip calls
315
- // to flash during the initialization process.
316
- setTimeout(function() {
317
- WebSocket.__flash = document.getElementById("webSocketFlash");
318
- WebSocket.__flash.setCallerUrl(location.href);
319
- WebSocket.__flash.setDebug(!!window.WEB_SOCKET_DEBUG);
320
- for (var i = 0; i < WebSocket.__tasks.length; ++i) {
321
- WebSocket.__tasks[i]();
322
- }
323
- WebSocket.__tasks = [];
324
- }, 0);
325
- };
326
-
327
- /**
328
- * Called by Flash to notify WebSockets events are fired.
329
- */
330
- WebSocket.__onFlashEvent = function() {
331
- setTimeout(function() {
332
- try {
333
- // Gets events using receiveEvents() instead of getting it from event object
334
- // of Flash event. This is to make sure to keep message order.
335
- // It seems sometimes Flash events don't arrive in the same order as they are sent.
336
- var events = WebSocket.__flash.receiveEvents();
337
- for (var i = 0; i < events.length; ++i) {
338
- WebSocket.__instances[events[i].webSocketId].__handleEvent(events[i]);
339
- }
340
- } catch (e) {
341
- logger.error(e);
342
- }
343
- }, 0);
344
- return true;
345
- };
346
-
347
- // Called by Flash.
348
- WebSocket.__log = function(message) {
349
- logger.log(decodeURIComponent(message));
350
- };
351
-
352
- // Called by Flash.
353
- WebSocket.__error = function(message) {
354
- logger.error(decodeURIComponent(message));
355
- };
356
-
357
- WebSocket.__addTask = function(task) {
358
- if (WebSocket.__flash) {
359
- task();
360
- } else {
361
- WebSocket.__tasks.push(task);
362
- }
363
- };
364
-
365
- /**
366
- * Test if the browser is running flash lite.
367
- * @return {boolean} True if flash lite is running, false otherwise.
368
- */
369
- WebSocket.__isFlashLite = function() {
370
- if (!window.navigator || !window.navigator.mimeTypes) {
371
- return false;
372
- }
373
- var mimeType = window.navigator.mimeTypes["application/x-shockwave-flash"];
374
- if (!mimeType || !mimeType.enabledPlugin || !mimeType.enabledPlugin.filename) {
375
- return false;
376
- }
377
- return mimeType.enabledPlugin.filename.match(/flashlite/i) ? true : false;
378
- };
379
-
380
- if (!window.WEB_SOCKET_DISABLE_AUTO_INITIALIZATION) {
381
- // NOTE:
382
- // This fires immediately if web_socket.js is dynamically loaded after
383
- // the document is loaded.
384
- swfobject.addDomLoadEvent(function() {
385
- WebSocket.__initialize();
386
- });
387
- }
388
-
389
- })();