lib/rack/websocket/application.rb in websocket-rack-0.1.1 vs lib/rack/websocket/application.rb in websocket-rack-0.1.2

- old
+ new

@@ -19,30 +19,30 @@ def call(env) if(env['HTTP_CONNECTION'].to_s.downcase == 'upgrade' && env['HTTP_UPGRADE'].to_s.downcase == 'websocket') @env = env socket = env['async.connection'] - @connection = Connection.new(self, socket) - @connection.dispatch(env) ? async_response : failure_response + @conn = Connection.new(self, socket, :debug => !!@options[:websocket_debug]) + @conn.dispatch(env) ? async_response : failure_response elsif @app @app.call(env) else - not_fount_response + not_found_response end end def close_websocket - if @connection - @connection.close_websocket + if @conn + @conn.close_websocket else raise WebSocketError, "WebSocket not opened" end end def send_data(data) - if @connection - @connection.send data + if @conn + @conn.send data else raise WebSocketError, "WebSocket not opened" end end @@ -54,10 +54,10 @@ def failure_response [ 400, { "Content-Type" => "text/plain" }, [ 'invalid data' ] ] end - def not_fount_response + def not_found_response [ 404, { "Content-Type" => "text/plain" }, [ 'not found' ] ] end end end \ No newline at end of file