Skip to content

Commit

Permalink
Make sure thin doesn't timeout and closes the websocket connection
Browse files Browse the repository at this point in the history
  • Loading branch information
lifo committed Jan 11, 2010
1 parent bc799fb commit a8b41d7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/cramp.rb
Expand Up @@ -5,6 +5,7 @@
require 'active_support/core_ext/class/inheritable_attributes'
require 'active_support/core_ext/class/attribute_accessors'
require 'active_support/core_ext/module/aliasing'
require 'active_support/core_ext/kernel/reporting'
require 'active_support/concern'

module Cramp
Expand Down
3 changes: 3 additions & 0 deletions lib/cramp/controller/websocket/thin_backend.rb
@@ -1,5 +1,7 @@
require 'thin'

silence_warnings { Thin::Server::DEFAULT_TIMEOUT = 0 }

class Thin::Connection
# Called when data is received from the client.
def receive_data(data)
Expand All @@ -12,6 +14,7 @@ def receive_data(data)
else
if @request.parse(data)
if @request.websocket?
@response.persistent!
@response.websocket_upgrade_data = @request.websocket_upgrade_data
@serving = :websocket
end
Expand Down

0 comments on commit a8b41d7

Please sign in to comment.