faye 0.5.5 → 0.6.0

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

Potentially problematic release.


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

Files changed (62) hide show
  1. data/History.txt +14 -0
  2. data/README.rdoc +98 -0
  3. data/Rakefile +17 -15
  4. data/lib/faye-browser-min.js +1 -1
  5. data/lib/faye.rb +14 -5
  6. data/lib/faye/adapters/rack_adapter.rb +12 -5
  7. data/lib/faye/engines/base.rb +62 -0
  8. data/lib/faye/engines/connection.rb +63 -0
  9. data/lib/faye/engines/memory.rb +89 -0
  10. data/lib/faye/engines/redis.rb +141 -0
  11. data/lib/faye/error.rb +16 -4
  12. data/lib/faye/mixins/publisher.rb +6 -0
  13. data/lib/faye/protocol/channel.rb +34 -86
  14. data/lib/faye/protocol/client.rb +36 -52
  15. data/lib/faye/protocol/extensible.rb +3 -0
  16. data/lib/faye/protocol/server.rb +119 -169
  17. data/lib/faye/transport/http.rb +45 -0
  18. data/lib/faye/transport/local.rb +15 -0
  19. data/lib/faye/{network → transport}/transport.rb +36 -49
  20. data/spec/browser.html +35 -0
  21. data/spec/install.sh +48 -0
  22. data/spec/javascript/channel_spec.js +15 -0
  23. data/spec/javascript/client_spec.js +610 -0
  24. data/spec/javascript/engine_spec.js +319 -0
  25. data/spec/javascript/faye_spec.js +15 -0
  26. data/spec/javascript/grammar_spec.js +66 -0
  27. data/spec/javascript/node_adapter_spec.js +276 -0
  28. data/spec/javascript/server/connect_spec.js +168 -0
  29. data/spec/javascript/server/disconnect_spec.js +121 -0
  30. data/spec/javascript/server/extensions_spec.js +60 -0
  31. data/spec/javascript/server/handshake_spec.js +153 -0
  32. data/spec/javascript/server/subscribe_spec.js +245 -0
  33. data/spec/javascript/server/unsubscribe_spec.js +245 -0
  34. data/spec/javascript/server_spec.js +146 -0
  35. data/spec/javascript/transport_spec.js +130 -0
  36. data/spec/node.js +34 -0
  37. data/spec/ruby/channel_spec.rb +17 -0
  38. data/spec/ruby/client_spec.rb +615 -0
  39. data/spec/ruby/engine_spec.rb +312 -0
  40. data/spec/ruby/faye_spec.rb +14 -0
  41. data/spec/ruby/grammar_spec.rb +68 -0
  42. data/spec/ruby/rack_adapter_spec.rb +209 -0
  43. data/spec/ruby/server/connect_spec.rb +170 -0
  44. data/spec/ruby/server/disconnect_spec.rb +120 -0
  45. data/spec/ruby/server/extensions_spec.rb +69 -0
  46. data/spec/ruby/server/handshake_spec.rb +151 -0
  47. data/spec/ruby/server/subscribe_spec.rb +247 -0
  48. data/spec/ruby/server/unsubscribe_spec.rb +247 -0
  49. data/spec/ruby/server_spec.rb +138 -0
  50. data/spec/ruby/transport_spec.rb +128 -0
  51. data/spec/spec_helper.rb +5 -0
  52. data/spec/testswarm.pl +200 -0
  53. data/spec/thin_proxy.rb +36 -0
  54. metadata +119 -84
  55. data/Manifest.txt +0 -27
  56. data/README.txt +0 -98
  57. data/lib/faye/protocol/connection.rb +0 -111
  58. data/test/scenario.rb +0 -172
  59. data/test/test_channel.rb +0 -54
  60. data/test/test_clients.rb +0 -381
  61. data/test/test_grammar.rb +0 -86
  62. data/test/test_server.rb +0 -488
@@ -0,0 +1,36 @@
1
+ require 'rack/proxy'
2
+
3
+ # This only exists so we can use Rack::Test to test the
4
+ # RackAdapter class, which assumes it's running on Thin
5
+
6
+ class ThinProxy < Rack::Proxy
7
+ HOST = 'localhost'
8
+ PORT = '8282'
9
+
10
+ def initialize(rack_app)
11
+ Thin::Logging.silent = true
12
+ handler = Rack::Handler.get('thin')
13
+
14
+ EM.stop if EM.reactor_running?
15
+ sleep 0.001 while EM.reactor_running?
16
+
17
+ Thread.new {
18
+ handler.run(rack_app, :Host => HOST, :Port => PORT) do |server|
19
+ @server = server
20
+ end
21
+ }
22
+ sleep 0.001 until EM.reactor_running?
23
+ end
24
+
25
+ def stop
26
+ EM.stop
27
+ @server.stop
28
+ sleep 0.001 while EM.reactor_running?
29
+ end
30
+
31
+ def rewrite_env(env)
32
+ env['HTTP_HOST'] = HOST
33
+ env['SERVER_PORT'] = PORT
34
+ env
35
+ end
36
+ end
metadata CHANGED
@@ -1,13 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: faye
3
3
  version: !ruby/object:Gem::Version
4
- hash: 1
5
- prerelease: false
6
- segments:
7
- - 0
8
- - 5
9
- - 5
10
- version: 0.5.5
4
+ prerelease:
5
+ version: 0.6.0
11
6
  platform: ruby
12
7
  authors:
13
8
  - James Coglan
@@ -15,7 +10,7 @@ autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
12
 
18
- date: 2011-01-16 00:00:00 +00:00
13
+ date: 2011-05-21 00:00:00 +01:00
19
14
  default_executable:
20
15
  dependencies:
21
16
  - !ruby/object:Gem::Dependency
@@ -24,13 +19,9 @@ dependencies:
24
19
  requirement: &id001 !ruby/object:Gem::Requirement
25
20
  none: false
26
21
  requirements:
27
- - - ">="
22
+ - - ~>
28
23
  - !ruby/object:Gem::Version
29
- hash: 19
30
- segments:
31
- - 0
32
- - 12
33
- version: "0.12"
24
+ version: 0.12.0
34
25
  type: :runtime
35
26
  version_requirements: *id001
36
27
  - !ruby/object:Gem::Dependency
@@ -41,113 +32,166 @@ dependencies:
41
32
  requirements:
42
33
  - - ">="
43
34
  - !ruby/object:Gem::Version
44
- hash: 15
45
- segments:
46
- - 0
47
- - 2
48
35
  version: "0.2"
49
36
  type: :runtime
50
37
  version_requirements: *id002
51
38
  - !ruby/object:Gem::Dependency
52
- name: rack
39
+ name: em-hiredis
53
40
  prerelease: false
54
41
  requirement: &id003 !ruby/object:Gem::Requirement
55
42
  none: false
56
43
  requirements:
57
44
  - - ">="
58
45
  - !ruby/object:Gem::Version
59
- hash: 15
60
- segments:
61
- - 1
62
- - 0
63
- version: "1.0"
46
+ version: 0.0.1
64
47
  type: :runtime
65
48
  version_requirements: *id003
66
49
  - !ruby/object:Gem::Dependency
67
- name: thin
50
+ name: json
68
51
  prerelease: false
69
52
  requirement: &id004 !ruby/object:Gem::Requirement
70
53
  none: false
71
54
  requirements:
72
55
  - - ">="
73
56
  - !ruby/object:Gem::Version
74
- hash: 11
75
- segments:
76
- - 1
77
- - 2
78
- version: "1.2"
57
+ version: "1.0"
79
58
  type: :runtime
80
59
  version_requirements: *id004
81
60
  - !ruby/object:Gem::Dependency
82
- name: json
61
+ name: thin
83
62
  prerelease: false
84
63
  requirement: &id005 !ruby/object:Gem::Requirement
85
64
  none: false
86
65
  requirements:
87
- - - ">="
66
+ - - ~>
88
67
  - !ruby/object:Gem::Version
89
- hash: 15
90
- segments:
91
- - 1
92
- - 0
93
- version: "1.0"
68
+ version: "1.2"
94
69
  type: :runtime
95
70
  version_requirements: *id005
96
71
  - !ruby/object:Gem::Dependency
97
- name: hoe
72
+ name: rack
98
73
  prerelease: false
99
74
  requirement: &id006 !ruby/object:Gem::Requirement
100
75
  none: false
101
76
  requirements:
102
77
  - - ">="
103
78
  - !ruby/object:Gem::Version
104
- hash: 47
105
- segments:
106
- - 2
107
- - 8
108
- - 0
109
- version: 2.8.0
110
- type: :development
79
+ version: "1.0"
80
+ type: :runtime
111
81
  version_requirements: *id006
112
- description: Simple pub/sub messaging for the web
113
- email:
114
- - jcoglan@googlemail.com
82
+ - !ruby/object:Gem::Dependency
83
+ name: jake
84
+ prerelease: false
85
+ requirement: &id007 !ruby/object:Gem::Requirement
86
+ none: false
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: "0"
91
+ type: :development
92
+ version_requirements: *id007
93
+ - !ruby/object:Gem::Dependency
94
+ name: rspec
95
+ prerelease: false
96
+ requirement: &id008 !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ version: "0"
102
+ type: :development
103
+ version_requirements: *id008
104
+ - !ruby/object:Gem::Dependency
105
+ name: rack-proxy
106
+ prerelease: false
107
+ requirement: &id009 !ruby/object:Gem::Requirement
108
+ none: false
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: "0"
113
+ type: :development
114
+ version_requirements: *id009
115
+ - !ruby/object:Gem::Dependency
116
+ name: rack-test
117
+ prerelease: false
118
+ requirement: &id010 !ruby/object:Gem::Requirement
119
+ none: false
120
+ requirements:
121
+ - - ">="
122
+ - !ruby/object:Gem::Version
123
+ version: "0"
124
+ type: :development
125
+ version_requirements: *id010
126
+ description:
127
+ email: jcoglan@gmail.com
115
128
  executables: []
116
129
 
117
130
  extensions: []
118
131
 
119
132
  extra_rdoc_files:
120
- - History.txt
121
- - Manifest.txt
122
- - README.txt
133
+ - README.rdoc
123
134
  files:
124
135
  - History.txt
125
- - Manifest.txt
126
- - README.txt
127
136
  - Rakefile
137
+ - README.rdoc
128
138
  - lib/faye-browser-min.js
129
- - lib/faye.rb
130
- - lib/thin_extensions.rb
131
- - lib/faye/adapters/rack_adapter.rb
139
+ - spec/browser.html
140
+ - spec/testswarm.pl
141
+ - spec/install.sh
142
+ - spec/thin_proxy.rb
143
+ - spec/ruby/server/handshake_spec.rb
144
+ - spec/ruby/server/extensions_spec.rb
145
+ - spec/ruby/server/subscribe_spec.rb
146
+ - spec/ruby/server/disconnect_spec.rb
147
+ - spec/ruby/server/unsubscribe_spec.rb
148
+ - spec/ruby/server/connect_spec.rb
149
+ - spec/ruby/rack_adapter_spec.rb
150
+ - spec/ruby/client_spec.rb
151
+ - spec/ruby/server_spec.rb
152
+ - spec/ruby/channel_spec.rb
153
+ - spec/ruby/transport_spec.rb
154
+ - spec/ruby/engine_spec.rb
155
+ - spec/ruby/faye_spec.rb
156
+ - spec/ruby/grammar_spec.rb
157
+ - spec/node.js
158
+ - spec/javascript/faye_spec.js
159
+ - spec/javascript/server/disconnect_spec.js
160
+ - spec/javascript/server/subscribe_spec.js
161
+ - spec/javascript/server/extensions_spec.js
162
+ - spec/javascript/server/unsubscribe_spec.js
163
+ - spec/javascript/server/connect_spec.js
164
+ - spec/javascript/server/handshake_spec.js
165
+ - spec/javascript/server_spec.js
166
+ - spec/javascript/engine_spec.js
167
+ - spec/javascript/transport_spec.js
168
+ - spec/javascript/channel_spec.js
169
+ - spec/javascript/node_adapter_spec.js
170
+ - spec/javascript/client_spec.js
171
+ - spec/javascript/grammar_spec.js
172
+ - spec/spec_helper.rb
173
+ - lib/faye/error.rb
174
+ - lib/faye/util/namespace.rb
175
+ - lib/faye/util/web_socket.rb
132
176
  - lib/faye/mixins/logging.rb
133
177
  - lib/faye/mixins/publisher.rb
134
178
  - lib/faye/mixins/timeouts.rb
135
- - lib/faye/network/transport.rb
136
- - lib/faye/protocol/channel.rb
179
+ - lib/faye/transport/http.rb
180
+ - lib/faye/transport/local.rb
181
+ - lib/faye/transport/transport.rb
137
182
  - lib/faye/protocol/client.rb
138
- - lib/faye/protocol/connection.rb
183
+ - lib/faye/protocol/subscription.rb
184
+ - lib/faye/protocol/server.rb
139
185
  - lib/faye/protocol/extensible.rb
186
+ - lib/faye/protocol/channel.rb
140
187
  - lib/faye/protocol/grammar.rb
141
- - lib/faye/protocol/server.rb
142
- - lib/faye/protocol/subscription.rb
143
- - lib/faye/util/namespace.rb
144
- - lib/faye/util/web_socket.rb
145
- - lib/faye/error.rb
146
- - test/scenario.rb
147
- - test/test_channel.rb
148
- - test/test_clients.rb
149
- - test/test_grammar.rb
150
- - test/test_server.rb
188
+ - lib/faye/adapters/rack_adapter.rb
189
+ - lib/faye/engines/connection.rb
190
+ - lib/faye/engines/memory.rb
191
+ - lib/faye/engines/redis.rb
192
+ - lib/faye/engines/base.rb
193
+ - lib/thin_extensions.rb
194
+ - lib/faye.rb
151
195
  has_rdoc: true
152
196
  homepage: http://faye.jcoglan.com
153
197
  licenses: []
@@ -155,7 +199,7 @@ licenses: []
155
199
  post_install_message:
156
200
  rdoc_options:
157
201
  - --main
158
- - README.txt
202
+ - README.rdoc
159
203
  require_paths:
160
204
  - lib
161
205
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -163,28 +207,19 @@ required_ruby_version: !ruby/object:Gem::Requirement
163
207
  requirements:
164
208
  - - ">="
165
209
  - !ruby/object:Gem::Version
166
- hash: 3
167
- segments:
168
- - 0
169
210
  version: "0"
170
211
  required_rubygems_version: !ruby/object:Gem::Requirement
171
212
  none: false
172
213
  requirements:
173
214
  - - ">="
174
215
  - !ruby/object:Gem::Version
175
- hash: 3
176
- segments:
177
- - 0
178
216
  version: "0"
179
217
  requirements: []
180
218
 
181
- rubyforge_project: faye
182
- rubygems_version: 1.3.7
219
+ rubyforge_project:
220
+ rubygems_version: 1.6.2
183
221
  signing_key:
184
222
  specification_version: 3
185
- summary: ""
186
- test_files:
187
- - test/test_clients.rb
188
- - test/test_grammar.rb
189
- - test/test_channel.rb
190
- - test/test_server.rb
223
+ summary: Simple pub/sub messaging for the web
224
+ test_files: []
225
+
data/Manifest.txt DELETED
@@ -1,27 +0,0 @@
1
- History.txt
2
- Manifest.txt
3
- README.txt
4
- Rakefile
5
- lib/faye-browser-min.js
6
- lib/faye.rb
7
- lib/thin_extensions.rb
8
- lib/faye/adapters/rack_adapter.rb
9
- lib/faye/mixins/logging.rb
10
- lib/faye/mixins/publisher.rb
11
- lib/faye/mixins/timeouts.rb
12
- lib/faye/network/transport.rb
13
- lib/faye/protocol/channel.rb
14
- lib/faye/protocol/client.rb
15
- lib/faye/protocol/connection.rb
16
- lib/faye/protocol/extensible.rb
17
- lib/faye/protocol/grammar.rb
18
- lib/faye/protocol/server.rb
19
- lib/faye/protocol/subscription.rb
20
- lib/faye/util/namespace.rb
21
- lib/faye/util/web_socket.rb
22
- lib/faye/error.rb
23
- test/scenario.rb
24
- test/test_channel.rb
25
- test/test_clients.rb
26
- test/test_grammar.rb
27
- test/test_server.rb
data/README.txt DELETED
@@ -1,98 +0,0 @@
1
- = Faye
2
-
3
- * http://faye.jcoglan.com
4
- * http://groups.google.com/group/faye-users
5
- * http://github.com/jcoglan/faye
6
-
7
- Faye is a set of tools for dirt-simple publish-subscribe messaging
8
- between web clients. It ships with easy-to-use message routing servers
9
- for Node.js and Rack applications, and clients that can be used on
10
- the server and in the browser.
11
-
12
- See http://faye.jcoglan.com for documentation.
13
-
14
-
15
- == Questions, issues, ideas
16
-
17
- Please raise questions on the mailing list: http://groups.google.com/group/faye-users,
18
- and feel free to announce and share ideas on Faye-related projects here
19
- too. I'd appreciate it if we only use the GitHub issue tracker for bona
20
- fide bugs; posting a question there will probably not get you a swift
21
- answer since I treat it as a to-do list for whenever I have time to work
22
- on this.
23
-
24
-
25
- == Development
26
-
27
- To hack on Faye, you'll need Ruby and Jake, which we use to build
28
- the JavaScript packages. Once you have Ruby installed:
29
-
30
- sudo gem install jake
31
-
32
- Just run `jake` from the root of the project to build the JavaScripts.
33
-
34
- The Ruby version depends on the following gems, which you'll need
35
- to install:
36
-
37
- sudo gem install hoe eventmachine em-http-request rack thin json
38
-
39
-
40
- == To-do
41
-
42
- Refactoring:
43
-
44
- * Refactor tests, put more unit tests in place for both versions
45
- * Separate protocol server from pub/sub engine to allow for alternate backends
46
- * Examine Client vs. Transport responsibilities, e.g. make message batching transport-dependent
47
-
48
- Fault tolerance:
49
-
50
- * Detect failed WebSocket connection and fall back to polling transports
51
-
52
- Notification API:
53
-
54
- * Notify listeners of network drop-out (may be transport dependent)
55
- * Provide reflection API for internal stats on channels, subscriptions, message queues
56
- * (Maybe) build a monitoring GUI into the server
57
-
58
- Sugar:
59
-
60
- * Add sugar for authentication extensions for protected subscribe + publish
61
-
62
- Performance:
63
-
64
- * Optimise channel unsubscription -- currently O(N) where N = clients
65
- * Provide hubs to connect multiple servers together in a network
66
- * (maybe) provide a backend based on Redis or AMQP
67
-
68
- Missing protocol features:
69
-
70
- * Provide support for user-defined <tt>/service/*</tt> channels
71
- * Let local server-side clients listen to <tt>/meta/*</tt> channels
72
-
73
-
74
- == License
75
-
76
- (The MIT License)
77
-
78
- Copyright (c) 2009-2010 James Coglan
79
-
80
- Permission is hereby granted, free of charge, to any person obtaining
81
- a copy of this software and associated documentation files (the
82
- 'Software'), to deal in the Software without restriction, including
83
- without limitation the rights to use, copy, modify, merge, publish,
84
- distribute, sublicense, and/or sell copies of the Software, and to
85
- permit persons to whom the Software is furnished to do so, subject to
86
- the following conditions:
87
-
88
- The above copyright notice and this permission notice shall be
89
- included in all copies or substantial portions of the Software.
90
-
91
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
92
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
93
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
94
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
95
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
96
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
97
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
98
-