websocket-rack 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG.md ADDED
@@ -0,0 +1,12 @@
1
+ # Changelog
2
+
3
+ ## 0.1.1 / 2011-03-07
4
+
5
+ - add missing gem dependencies
6
+ - clear connection inactivity timeout for websocket connections
7
+ - inform about bug in EM < 1.0.0
8
+ - add thin-websocket wrapper around thin binary
9
+
10
+ ## 0.1.0 / 2011-03-05
11
+
12
+ - initial release
data/README.md CHANGED
@@ -95,6 +95,23 @@ Rack env - contain all data sent by client when connectind.
95
95
 
96
96
  Thin wrapper between client and EventMachine::Connection
97
97
 
98
+ ## FAQ
99
+
100
+ ### Which Rack servers are supported?
101
+
102
+ Currently only Thin. I plan to support also Rainbows! in future, but not yet.
103
+
104
+ ### Why (using Thin) user is disconnected after 30 seconds?
105
+
106
+ This is bug in EventMachine < 1.0.0. Please consider updating to newer version or use thin-websocket wrapper around thin binary.
107
+
108
+ ### How to enable wss/SSL support?
109
+
110
+ Thin v1.2.8 have --ssl option - just use that! :)
111
+
112
+ ### How to use function xxx?
113
+
114
+ Check [Thin](http://code.macournoyer.com/thin/) config - any option supported by Thin(like demonizing, SSL etc.) is supported by WebSocket-Rack.
98
115
 
99
116
  ## About
100
117
 
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env ruby
2
+ # Modified Thin command line interface script.
3
+ # This is fallback for WebSocket-Rack.
4
+ # Use it when you have EventMachine version < 1.0.0
5
+ # Rationale:
6
+ # Older versions of EM have bug that prevent to
7
+ # clearing connection inactivity once it's set.
8
+ # This one will set connection timeout to 0 at
9
+ # default, so there will be no need to overwrite it.
10
+ # Be aware that this will also change inactivity
11
+ # timeout for "normal" connection, so it will be
12
+ # easy to make DoS attack.
13
+
14
+ require 'rubygems'
15
+ require 'thin'
16
+
17
+ if EM::VERSION < "1.0.0"
18
+ begin
19
+ old_verbose, $VERBOSE = $VERBOSE, nil
20
+ ::Thin::Server.const_set 'DEFAULT_TIMEOUT', 0
21
+ ensure
22
+ $VERBOSE = old_verbose
23
+ end
24
+ end
25
+
26
+ Thin::Runner.new(ARGV).run!
@@ -12,6 +12,13 @@ module Rack
12
12
  @debug = options[:debug] || false
13
13
 
14
14
  socket.websocket = self
15
+ socket.comm_inactivity_timeout = 0
16
+
17
+ if socket.comm_inactivity_timeout != 0
18
+ puts "WARNING: You are using old EventMachine version. " +
19
+ "Please consider updating to EM version >= 1.0.0 " +
20
+ "or running Thin using thin-websocket."
21
+ end
15
22
 
16
23
  debug [:initialize]
17
24
  end
@@ -2,7 +2,7 @@ require 'rack'
2
2
 
3
3
  module Rack
4
4
  module WebSocket
5
- VERSION = "0.1.0"
5
+ VERSION = "0.1.1"
6
6
  ROOT_PATH = ::File.expand_path(::File.dirname(__FILE__))
7
7
 
8
8
  class WebSocketError < RuntimeError; end
@@ -13,6 +13,8 @@ Gem::Specification.new do |s|
13
13
  s.description = %q{Rack-based WebSocket server}
14
14
 
15
15
  s.add_dependency 'rack'
16
+ s.add_dependency 'addressable', '>= 2.1.1'
17
+ s.add_dependency 'eventmachine', '>= 0.12.9'
16
18
  s.add_dependency 'thin'
17
19
  s.add_development_dependency 'rspec', '~> 2.4.0'
18
20
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: websocket-rack
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 0
10
- version: 0.1.0
9
+ - 1
10
+ version: 0.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Bernard Potocki
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-03-05 00:00:00 +01:00
18
+ date: 2011-03-07 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -33,9 +33,41 @@ dependencies:
33
33
  type: :runtime
34
34
  version_requirements: *id001
35
35
  - !ruby/object:Gem::Dependency
36
- name: thin
36
+ name: addressable
37
37
  prerelease: false
38
38
  requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ hash: 9
44
+ segments:
45
+ - 2
46
+ - 1
47
+ - 1
48
+ version: 2.1.1
49
+ type: :runtime
50
+ version_requirements: *id002
51
+ - !ruby/object:Gem::Dependency
52
+ name: eventmachine
53
+ prerelease: false
54
+ requirement: &id003 !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ hash: 61
60
+ segments:
61
+ - 0
62
+ - 12
63
+ - 9
64
+ version: 0.12.9
65
+ type: :runtime
66
+ version_requirements: *id003
67
+ - !ruby/object:Gem::Dependency
68
+ name: thin
69
+ prerelease: false
70
+ requirement: &id004 !ruby/object:Gem::Requirement
39
71
  none: false
40
72
  requirements:
41
73
  - - ">="
@@ -45,11 +77,11 @@ dependencies:
45
77
  - 0
46
78
  version: "0"
47
79
  type: :runtime
48
- version_requirements: *id002
80
+ version_requirements: *id004
49
81
  - !ruby/object:Gem::Dependency
50
82
  name: rspec
51
83
  prerelease: false
52
- requirement: &id003 !ruby/object:Gem::Requirement
84
+ requirement: &id005 !ruby/object:Gem::Requirement
53
85
  none: false
54
86
  requirements:
55
87
  - - ~>
@@ -61,21 +93,23 @@ dependencies:
61
93
  - 0
62
94
  version: 2.4.0
63
95
  type: :development
64
- version_requirements: *id003
96
+ version_requirements: *id005
65
97
  description: Rack-based WebSocket server
66
98
  email:
67
99
  - bernard.potocki@imanel.org
68
- executables: []
69
-
100
+ executables:
101
+ - thin-websocket
70
102
  extensions: []
71
103
 
72
104
  extra_rdoc_files: []
73
105
 
74
106
  files:
75
107
  - .gitignore
108
+ - CHANGELOG.md
76
109
  - Gemfile
77
110
  - README.md
78
111
  - Rakefile
112
+ - bin/thin-websocket
79
113
  - example/example.ru
80
114
  - example/html/FABridge.js
81
115
  - example/html/WebSocketMain.swf
@@ -134,7 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
134
168
  requirements: []
135
169
 
136
170
  rubyforge_project:
137
- rubygems_version: 1.4.2
171
+ rubygems_version: 1.6.1
138
172
  signing_key:
139
173
  specification_version: 3
140
174
  summary: Rack-based WebSocket server