# File lib/ftw/websocket/rack.rb, line 77 def rack_response if valid? # Return the status, headers, body that is expected. sec_accept = @key + WEBSOCKET_ACCEPT_UUID sec_accept_hash = Digest::SHA1.base64digest(sec_accept) headers = { "Upgrade" => "websocket", "Connection" => "Upgrade", "Sec-WebSocket-Accept" => sec_accept_hash } # See RFC6455 section 4.2.2 return 101, headers, nil else # Invalid request, tell the client why. return 400, { "Content-Type" => "text/plain" }, @handshake_errors.map { |m| "#{m}#{CRLF}" } end end