Skip to content
This repository
James Coglan August 30, 2011
file 22 lines (16 sloc) 0.598 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
require 'rubygems'
require './lib/faye'

task :example, :port, :ssl do |t, args|
  exec "ruby examples/ruby/server.rb #{args[:port]} #{args[:ssl] && 'ssl'}"
end

task :handshake, :port, :n, :c do |t, args|
  require 'cgi'
  require 'json'
  
  message = {:channel => '/meta/handshake',
             :version => '1.0',
             :supportedConnectionTypes => ['long-polling']}
  
  message = CGI.escape(JSON.dump message)
  url = "http://127.0.0.1:#{args[:port]}/bayeux?jsonp=callback&message=#{message}"
  puts "Request URL:\n#{url}\n\n"
  
  exec "ab -n #{args[:n]} -c #{args[:c]} '#{url}'"
end
Something went wrong with that request. Please try again.