faye-websocket 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of faye-websocket might be problematic. Click here for more details.

data/examples/index.html CHANGED
@@ -20,10 +20,10 @@
20
20
  socket.send('Hello, world');
21
21
  };
22
22
 
23
- socket.onmessage = function(event) {
23
+ socket.addEventListener('message', function(event) {
24
24
  logger.innerHTML += '<li>MESSAGE: ' + event.data + '</li>';
25
25
  setTimeout(function() { socket.send(++index + ' ' + event.data) }, 2000);
26
- };
26
+ });
27
27
 
28
28
  socket.onclose = function(event) {
29
29
  logger.innerHTML += '<li>CLOSE: ' + event.code + ', ' + event.reason + '</li>';
@@ -50,13 +50,13 @@ module Faye
50
50
  end
51
51
  end
52
52
 
53
- def add_event_listener(type, listener, use_capture)
53
+ def add_event_listener(event_type, listener, use_capture = false)
54
54
  @listeners ||= {}
55
55
  list = @listeners[event_type] ||= []
56
56
  list << listener
57
57
  end
58
58
 
59
- def remove_event_listener(type, listener, use_capture)
59
+ def remove_event_listener(event_type, listener, use_capture = false)
60
60
  return unless @listeners and @listeners[event_type]
61
61
  return @listeners.delete(event_type) unless listener
62
62
 
@@ -70,9 +70,9 @@ module Faye
70
70
  callback = __send__("on#{ event.type }")
71
71
  callback.call(event) if callback
72
72
 
73
- return unless @listeners and @listeners[event_type]
74
- @listeners[event_type].each do |listener|
75
- listener.call(*args)
73
+ return unless @listeners and @listeners[event.type]
74
+ @listeners[event.type].each do |listener|
75
+ listener.call(event)
76
76
  end
77
77
  end
78
78
  end
@@ -51,7 +51,7 @@ WebSocketSteps = EM::RSpec.async_steps do
51
51
  end
52
52
 
53
53
  def listen_for_message(&callback)
54
- @ws.onmessage = lambda { |e| @message = e.data }
54
+ @ws.add_event_listener('message', lambda { |e| @message = e.data })
55
55
  callback.call
56
56
  end
57
57
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: faye-websocket
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-11-28 00:00:00.000000000 Z
12
+ date: 2011-11-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: eventmachine
16
- requirement: &2152439260 !ruby/object:Gem::Requirement
16
+ requirement: &5563640 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.12.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2152439260
24
+ version_requirements: *5563640
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: thin
27
- requirement: &2152438100 !ruby/object:Gem::Requirement
27
+ requirement: &5561880 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '1.2'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2152438100
35
+ version_requirements: *5561880
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rspec
38
- requirement: &2152437380 !ruby/object:Gem::Requirement
38
+ requirement: &5559960 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 2.5.0
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *2152437380
46
+ version_requirements: *5559960
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rack
49
- requirement: &2152436360 !ruby/object:Gem::Requirement
49
+ requirement: &5558480 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *2152436360
57
+ version_requirements: *5558480
58
58
  description:
59
59
  email: jcoglan@gmail.com
60
60
  executables: []
@@ -63,22 +63,22 @@ extra_rdoc_files:
63
63
  - README.rdoc
64
64
  files:
65
65
  - README.rdoc
66
- - examples/autobahn_client.rb
67
66
  - examples/client.rb
68
- - examples/index.html
69
67
  - examples/server.rb
70
- - lib/faye/thin_extensions.rb
71
- - lib/faye/websocket/api.rb
72
- - lib/faye/websocket/client.rb
68
+ - examples/index.html
69
+ - examples/autobahn_client.rb
73
70
  - lib/faye/websocket/draft75_parser.rb
74
- - lib/faye/websocket/draft76_parser.rb
71
+ - lib/faye/websocket/client.rb
75
72
  - lib/faye/websocket/protocol8_parser.rb
73
+ - lib/faye/websocket/draft76_parser.rb
74
+ - lib/faye/websocket/api.rb
76
75
  - lib/faye/websocket.rb
77
- - spec/faye/websocket/client_spec.rb
76
+ - lib/faye/thin_extensions.rb
78
77
  - spec/faye/websocket/draft75_parser_spec.rb
78
+ - spec/faye/websocket/client_spec.rb
79
79
  - spec/faye/websocket/protocol8_parser_spec.rb
80
- - spec/server.crt
81
80
  - spec/server.key
81
+ - spec/server.crt
82
82
  - spec/spec_helper.rb
83
83
  homepage: http://github.com/jcoglan/faye-websocket-ruby
84
84
  licenses: []