websocket-rack 0.1.1 → 0.1.2
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 +6 -1
- data/README.md +4 -0
- data/example/example.ru +1 -1
- data/lib/rack/websocket/application.rb +8 -8
- data/lib/rack/websocket/connection.rb +1 -1
- data/lib/rack/websocket.rb +1 -1
- metadata +4 -4
data/CHANGELOG.md
CHANGED
@@ -1,9 +1,14 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 0.1.2 / 2011-03-08
|
4
|
+
|
5
|
+
- change Rack::WebSocket::Application @connection variable name to @conn - first one is to often used to block it
|
6
|
+
- allow debugging of WebSocket connection
|
7
|
+
|
3
8
|
## 0.1.1 / 2011-03-07
|
4
9
|
|
5
10
|
- add missing gem dependencies
|
6
|
-
- clear connection inactivity timeout for
|
11
|
+
- clear connection inactivity timeout for WebSocket connections
|
7
12
|
- inform about bug in EM < 1.0.0
|
8
13
|
- add thin-websocket wrapper around thin binary
|
9
14
|
|
data/README.md
CHANGED
@@ -105,6 +105,10 @@ Currently only Thin. I plan to support also Rainbows! in future, but not yet.
|
|
105
105
|
|
106
106
|
This is bug in EventMachine < 1.0.0. Please consider updating to newer version or use thin-websocket wrapper around thin binary.
|
107
107
|
|
108
|
+
### How to enable debugging?
|
109
|
+
|
110
|
+
Just use :websocket\_debug => true option when initializing your app.
|
111
|
+
|
108
112
|
### How to enable wss/SSL support?
|
109
113
|
|
110
114
|
Thin v1.2.8 have --ssl option - just use that! :)
|
data/example/example.ru
CHANGED
@@ -21,26 +21,26 @@ module Rack
|
|
21
21
|
if(env['HTTP_CONNECTION'].to_s.downcase == 'upgrade' && env['HTTP_UPGRADE'].to_s.downcase == 'websocket')
|
22
22
|
@env = env
|
23
23
|
socket = env['async.connection']
|
24
|
-
@
|
25
|
-
@
|
24
|
+
@conn = Connection.new(self, socket, :debug => !!@options[:websocket_debug])
|
25
|
+
@conn.dispatch(env) ? async_response : failure_response
|
26
26
|
elsif @app
|
27
27
|
@app.call(env)
|
28
28
|
else
|
29
|
-
|
29
|
+
not_found_response
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
33
|
def close_websocket
|
34
|
-
if @
|
35
|
-
@
|
34
|
+
if @conn
|
35
|
+
@conn.close_websocket
|
36
36
|
else
|
37
37
|
raise WebSocketError, "WebSocket not opened"
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
41
|
def send_data(data)
|
42
|
-
if @
|
43
|
-
@
|
42
|
+
if @conn
|
43
|
+
@conn.send data
|
44
44
|
else
|
45
45
|
raise WebSocketError, "WebSocket not opened"
|
46
46
|
end
|
@@ -56,7 +56,7 @@ module Rack
|
|
56
56
|
[ 400, { "Content-Type" => "text/plain" }, [ 'invalid data' ] ]
|
57
57
|
end
|
58
58
|
|
59
|
-
def
|
59
|
+
def not_found_response
|
60
60
|
[ 404, { "Content-Type" => "text/plain" }, [ 'not found' ] ]
|
61
61
|
end
|
62
62
|
|
data/lib/rack/websocket.rb
CHANGED
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:
|
4
|
+
hash: 31
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 2
|
10
|
+
version: 0.1.2
|
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-
|
18
|
+
date: 2011-03-08 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|