lib/faye/adapters/rack_adapter.rb in faye-0.6.3 vs lib/faye/adapters/rack_adapter.rb in faye-0.6.4

- old
+ new

@@ -57,11 +57,11 @@ return @app ? @app.call(env) : [404, TYPE_TEXT, ["Sure you're not looking for #{@endpoint} ?"]] end return handle_options(request) if env['REQUEST_METHOD'] == 'OPTIONS' - return handle_upgrade(request) if env['HTTP_UPGRADE'] == 'WebSocket' + return handle_upgrade(request) if env['HTTP_UPGRADE'] =~ /^WebSocket$/i return [200, TYPE_SCRIPT, File.new(SCRIPT_PATH)] if request.path_info =~ /\.js$/ handle_request(request) end private @@ -125,12 +125,12 @@ socket = Faye::WebSocket.new(request) socket.onmessage = lambda do |message| begin message = JSON.parse(message.data) - debug 'Received via WebSocket: ?', message + debug "Received via WebSocket[#{socket.version}]: ?", message @server.process(message, false) do |replies| - debug 'Sending via WebSocket: ?', replies + debug "Sending via WebSocket[#{socket.version}]: ?", replies socket.send(JSON.unparse(replies)) end rescue end end